Performance: Including mixins with @include
MEDIUM IMPACT
This affects CSS file size and browser rendering speed by controlling how styles are reused and duplicated.
@mixin button-style { padding: 1rem; border-radius: 0.5rem; background-color: blue; color: white; } .button-primary { @include button-style; } .button-secondary { @include button-style; background-color: gray; }
@include button-style; @include button-style; @include button-style;
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Repeated @include of large mixins | No direct DOM impact | No direct reflows | Higher paint cost due to larger CSS | [X] Bad |
| Single @include with customization | No direct DOM impact | No direct reflows | Lower paint cost with smaller CSS | [OK] Good |