This is no longer supported, please consider using Cream fork instead.
Set of front-end tools for Magento 2
- Unix-like OS (please, do not ask about Windows support)
- Node.js LTS version. We recommend using Volta.
- Magento 2 project with SASS based theme for example SASS version of "Blank" or Alpaca Theme
- Run
composer require snowdog/frontools - Go to package directory
cd vendor/snowdog/frontools - Run
yarnornpm install - Decide where you want to keep your config files.
You can store them in Frontools
configdirectory or indev/tools/frontools/config(recommended). There is asetuptask to copy all sample config files from theconfigtodev/tools/frontools/configand create a convenient symlinktoolsin the project root. If you want to keep config files inside frontoolsconfigdir, you have to handle this manually. - Define your themes in
themes.json.
Check config/themes.json.sample to get samples.
src- full path to themedest- full path topub/static/[theme_area]/[theme_vendor]/[theme_name]locale- array of available localesparent- name of parent themestylesDir- (defaultstyles) path to styles directory. Fortheme-blank-sassit'sstyles. By default Magento 2 useweb/css.disableSuffix- disable adding.minsuffix using--prodflag.postcss- (default["autoprefixer({ overrideBrowserslist: browserslist })"]) PostCSS plugins config. Have to be an array.modules- list of modules witch you want to map inside your themeignore- array of ignore patterns
Check config/watcher.json.sample to get samples.
usePolling- set this totrueto successfully watch files over a network (i.e. Docker or Vagrant) or when your watcher dosen't work well. Warning, enabling this option may lead to high CPU utilization! chokidar docs
You can choose Sass compiler between the default, but already deprecated, node-sass or a newer and faster dart-sass.
Since the Dart Sass does not have the same set of features as Node Sass, for now we will keep the older version as default.
You will find sample config files for theses plugins in vendor/snowdog/frontools/config directory.
- Create browserSync configuration
- Create eslint configuration
- Create sass-lint configuration
- Create stylelint configuration
- Create svg-sprite configuration
Use yarn [taskName] or npm run [taskName] to run the task.
babel- Run Babel, a compiler for writing next generation JavaScript.--theme name- Process single theme.--prod- Production output - minifies and uglyfy code.
clean- Removes/pub/staticdirectory content.csslint- Run stylelint based tests.--theme name- Process single theme.--ci- Enable throwing errors. Useful in CI/CD pipelines.
dev- Runs browserSync andinheritance,babel,styles,watchtasks.--theme name- Process single theme.--disableLinting- Disable JS, SASS, CSS linting.--disableMaps- Disable inline source maps generation.
emailfix- Fixes email stylesheet for Magento < 2.3.0. Related issue--prod- Production output - minifies styles and add.minsufix.
eslint- Run eslint against all JS files.--theme name- Process single theme.--fix- Autofix errors--ci- Enable throwing errors. Useful in CI/CD pipelines.
inheritance- Create necessary symlinks to resolve theme styles inheritance and make the base for styles processing. You have to run in before styles compilation and after adding new files.magepackBundle- Run magepackbundlecommand.-cor--config- (required) Path to previously generated Magepack config file.--theme name- Process single theme.
magepackGenerate- Run magepackgeneratecommand.--cms-url- (required) URL to one of CMS pages (e.g. homepage).--category-url- (required) URL to one of category pages.--product-url- (required) URL to one of product pages.-uor--auth-username- Username for Basic Auth.-por--auth-password- Passoword for Basic Auth.-dor--debug- Turn on debugging mode.
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- Disable inline source maps generation.--prod- Production output - minifies styles and add.minsuffix.--ci- Enable throwing errors. Useful in CI/CD pipelines.
svg- Run svg-sprite to generate SVG sprite.--theme name- Process single theme.
watch- Watch for style changes and run processing tasks.--theme name- Process single theme.--disableLinting- Disable JS, SASS, CSS linting.--disableMaps- Disable inline source maps generation.