CSS preprocessor
A tool such as Sass or Less that takes an extended stylesheet language and compiles it into plain CSS before the browser sees it.
In more detail
Preprocessors added variables and nesting long before CSS had them. Their variables vanish at compile time, so changing a theme meant building a whole new stylesheet. CSS custom properties now do this at run time in the browser.
Example
In the browser: Preprocessor variables are replaced at build time, while CSS custom properties exist in the browser and can change at runtime. Native CSS nesting now covers the most common reason for using a preprocessor.Related terms
- Sass — A CSS preprocessor whose SCSS syntax adds variables, nesting and functions and compiles to plain CSS.
- CSS custom property — A value you name yourself in CSS, such as --color-primary: #2563eb, and use elsewhere with var(--color-primary).
- CSS custom property — A property you define yourself with a double-hyphen name, such as --brand: #0066cc, and read elsewhere with var(--brand).
- CSS nesting — Writing CSS rules inside other rules so they apply to descendants or variants, a feature browsers now support natively.
Taught in
- CSS Custom Properties & Dynamic Theming Architecture — Design Systems & Component Engineering
- CSS Custom Properties: Scoping, Fallbacks And Theming — Frontend Architecture & Web Platform
- Modern Selectors: :has(), :is(), :where() And Nesting Standards — Frontend Architecture & Web Platform