Powerful, modern, configurable Frontend task runner
This is the ultimate toolbox for frontend developers powered by Node and Gulp.
It contains powerful PostCSS compiler, CSS linter (stylelint), minifier and optimizer (cssnano & media query grouping), JavaScript linter (ESLint), minifier and optimizer (UglifyJS), and assets handler & optimizer (images and favicons).
Default config for file structure and build structure was made with creating Magento themes in mind, but can be easily configured.
This toolbox works in 2 modes:
- Development - non-minified CSS and JavaScript compilation with SourceMaps ready for debugging.
- Production - minified and production-optimized CSS and JavaScript without SourceMaps.
src/
is your working directory for CSS, JavaScript and images.
images/
- Folder for theme image files (jpg, jpeg, gif, png, svg).js/
- Folder for JavaScript files.js/vendor/
- Folder for vendor Javascript files that will not be linted during build.css/
- Folder for CSS / PCSS files.css/styles.pcss
is the main entry point.css/vendor/
- Folder for vendor CSS / PCSS files that will not be linted during build.
- PostCSS
- JavaScript minifier
- postcss-easy-import
- postcss-mixins
- postcss-preset-env
- autoprefixer
- normalize.css
- css-mqpacker
- cssnano
- lost grid
- Image Minification
- Favicon Generator
- CSS Linter
- JavaScript Linter
- Favicon Generator
- Image Minification
- Autoprefixer
- Gulp
- Stylelint
- ESLint
- NodeJS version 8 and newer (even 11 is suported)
In Parent folder, run
npm run setup
Run the scripts from the parent folder
Runs all toolbox watchers (CSS, JavaScript and Image Handler) in development mode.
npm run watch:dev
Runs all toolbox watchers (CSS, JavaScript and Image Handler) in production mode
npm run watch:production
Runs all toolbox tasks (CSS, JavaScript and Image Handler) in development mode once.
npm run generate:dev
Runs all toolbox tasks (CSS, JavaScript and Image Handler) in production mode once.
npm run generate:production
Runs CSS and JavaScript linting tasks
npm run lint
Generates favicon assets.
npm run generate:favicon"
Generate minified image assets.
npm run generate:images
Only edit these files when necessary. The current setup ensures best practices when writing Javascript and CSS code.
Gulp config is handled by the gulpconfig.js
located in the parent folder. Following definitions can be found there:
- File input and output paths
- File suffixes
- PostCSS Compiler & Plugins config
- Autoprefixer config
- Favicon generator config
postcss-preset-env: https://preset-env.cssdb.org/features
Autoprefixer config: http://browserl.ist/
https://github.com/sindresorhus/gulp-autoprefixer
Favicon Generator: https://github.com/evilebottnawi/favicons
Javascript config is handled by the ESlint.
JSRC config info: https://eslint.org/docs/user-guide/configuring
CSS linter config is handled by the .stylelintrc
file in parent folder.
CSS linter config info: https://stylelint.io/user-guide/rules/
MIT License Copyright (c) 2019. Adrian Bece
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.