CSS Preprocessors: Sass, LESS, Stylus, etc.

CSS Preprocessors: Sass, LESS, Stylus, etc.

To use the Sass, LESS or Stylus pre-processors, enable the one you want in webpack.config.js:

  1. // webpack.config.js
  2. // ...
  3. Encore
  4. // ...
  5. // enable just the one you want
  6. // processes files ending in .scss or .sass
  7. .enableSassLoader()
  8. // processes files ending in .less
  9. .enableLessLoader()
  10. // processes files ending in .styl
  11. .enableStylusLoader()
  12. ;

Then restart Encore. When you do, it will give you a command you can run to install any missing dependencies. After running that command and restarting Encore, you’re done!

You can also pass configuration options to each of the loaders. See the Encore’s index.js file for detailed documentation.

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.