Performance: Preprocessor support (SCSS, PostCSS)
MEDIUM IMPACT
This affects the CSS loading and rendering speed by changing how styles are processed and delivered to the browser.
<style lang="scss">
$primary-color: red;
.btn {
color: $primary-color;
font-weight: bold;
&:hover { color: blue; }
}
</style><style>
.btn { color: red; font-weight: bold; }
.btn:hover { color: blue; }
</style>| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Plain CSS with repeated selectors | Minimal | Multiple if styles change dynamically | Higher due to larger CSS | [X] Bad |
| SCSS with variables and nesting | Minimal | Single or fewer reflows | Lower due to optimized CSS | [OK] Good |