Performance: Vendor prefix mixin patterns
MEDIUM IMPACT
This affects CSS file size and rendering speed by controlling how many vendor-prefixed properties are generated and applied.
@mixin box-shadow($value) { box-shadow: $value; } .element { @include box-shadow(2px 2px 5px #000); }
@mixin box-shadow($value) { -webkit-box-shadow: $value; -moz-box-shadow: $value; box-shadow: $value; } .element { @include box-shadow(2px 2px 5px #000); }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Mixin with all vendor prefixes | No extra DOM nodes | Triggers 1 reflow per style recalculation | Higher paint cost due to larger CSS | [X] Bad |
| Mixin with only standard property | No extra DOM nodes | Single reflow | Lower paint cost with smaller CSS | [OK] Good |