Performance: Avoiding selector bloat from @extend
MEDIUM IMPACT
This affects CSS file size and browser rendering speed by controlling how many selectors are generated and matched.
@mixin button-style { padding: 1rem; border-radius: 0.5rem; } .button { @include button-style; } .alert { @include button-style; } .card { @include button-style; }
@extend .button; @extend .alert; @extend .card;
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Multiple @extend on different selectors | No direct DOM changes | 0 | High due to complex selector matching | [X] Bad |
| Using mixins for style reuse | No direct DOM changes | 0 | Low due to simple selectors | [OK] Good |