Set of front-end tools for Magento 2, based on Gulp.js
If you have any questions about this project let's go to offical Magento forum - Less to Sass Community Project
LESS support was droped in version 1.0.0. Feel free to use older version (0.11.4 and lower) or create fork and customize newer versions to fit your needs.
Up from version 1.0.0 we are supporting both Node.js packages managers. If you want to keep modules in safe versions all the time, use Yarn, yarn.lock is already added to repository.
- Node.js LTS version (v6 branch). We recommend to use avn to automate version switching. Required configuration is already added to repository as
.node-versionfile. - Gulp CLI global package -
npm install -g gulp-clioryarn global add gulp-cli - Magento 2 project with SASS based theme i.e. SASS version of "Blank"
- Run
composer require snowdog/frontools - Go to package directory
/vendor/snowdog/frontools - Run
npm installoryarn - Decide where you want to keep your config files.
You can store them in frontools
configdir or/dev/tools/frontools/config. There is agulp setuptask to copy all sample config files from theconfigto/dev/tools/frontools/configand create a convenient symlink in project root. If you want to keep config files inside frontoolsconfigdir, you have to handle this manually. - Define your themes in
themes.json
First of all check config/themes.json.sample
src- full path to themedest- full path topub/static/[theme_area]/[theme_vendor]/[theme_name]parent- name of parent themelocale- array of available localeslocaleOverwrites- set totrueonly if your theme have per locale customizationslang- define styles lang want to use for processing, should be same as files extension. Out of the box Frontools supports onlyscsspostcss- (optional) PostCSS plugins config - have to be an array
- Create browserSync configuration
- Create eslint configuration
- Create sass-lint configuration
- Create stylelint configuration
browser-sync- run browserSync- do not run this task separately, it's just a part ofdevtaskclean- Removes/pub/staticfoldercsslint- Run stylelint based tests--theme name- Process single theme--ci - Enable throwing errors, useful in CI/CD pipelines
default- typegulpto see this readme in consoledeploy- Resolve theme inheritance of static assets (i.e. fonts, images) symlinking them topubdir.--theme name- Deploy single theme--prod- Copy files instead of making symlinks
dev- Runsbrowser-sync,inheritanceandwatchtasks--theme name- Process single theme--disableLinting- Disable SASS and CSS linting--disableMaps- Toggles source maps generation--prod- Production output - minifies styles
eslint- Watch and run eslint on specified JS file--file fileName- You have to specify what file you want to lint, fileName without .js
inheritance- Create necessary symlinks to resolve theme styles inheritance and make base for styles processing. You have to run in before sytles compilation and after adding new files.release- Cleanpub/static, deploy all necessary files and compiles everything with--prodflag. Makes code production ready.sasslint- Run sass-lint based tests--theme name- Process single theme--ci - Enable throwing errors, useful in CI/CD pipelines
setup- Creates a convenient symlink from/toolsto/vendor/snowdog/frontoolsand copies all sample files if no configuration exists--symlink name- if you don't want to usetoolsas the symlink you can specify another name
styles- Use this task to manually trigger styles processing pipeline--theme name- Process single theme--disableMaps- Toggles source maps generation--prod- Production output - minifies styles
watch- Watch for style changes and run processing tasks--theme name- Process single theme--disableLinting- Disable SASS and CSS linting--disableMaps- Enable inline source maps generation--prod- Production output - minifies styles