Performance: Variable arguments in mixins
MEDIUM IMPACT
This affects CSS generation time and final CSS file size, impacting page load speed and rendering.
@mixin box-shadow($shadows) { box-shadow: $shadows; } .element { @include box-shadow(0 0 5px rgba(0,0,0,0.3)); }
@mixin box-shadow($shadows...) { box-shadow: $shadows; } .element { @include box-shadow(0 0 5px rgba(0,0,0,0.3), 0 0 10px rgba(0,0,0,0.2)); }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Variable arguments with many values | No direct DOM impact | No direct reflows | Higher paint cost due to larger CSS | [!] OK |
| Single argument or limited values | No direct DOM impact | No direct reflows | Lower paint cost due to smaller CSS | [OK] Good |