Enjoy 20% off all plans by following us on social media. Check out other promotions!
Quiz Questions

What are the advantages/disadvantages of using CSS preprocessors?

Topics
CSS
Edit on GitHub

Advantages

  • CSS is made more maintainable.
  • Easier to write nested selectors.
  • Variables for consistent theming. Can share theme files across different projects. This is not necessarily useful with CSS custom properties (frequently called CSS variables).
  • Mixins to generate repeated CSS.
  • Sass and Less have features like loops, lists, and maps can make configuration easier and less verbose.
  • Splitting your code into multiple files during development. CSS files can be split up too but doing so will require an HTTP request to download each CSS file.

Disadvantages

  • Requires tools for preprocessing. Re-compilation time can be slow.
  • Not writing currently and potentially usable CSS. For example, by using something like postcss-loader with webpack, you can write potentially future-compatible CSS, allowing you to use things like CSS variables instead of Sass variables. Thus, you're learning new syntax that could pay off if/when they become standardized.
Edit on GitHub