Performance: Content blocks with @content
LOW IMPACT
This affects CSS preprocessing time and the final CSS bundle size, indirectly influencing page load speed.
@mixin button-style($color) { background-color: $color; border-radius: 0.5rem; padding: 1rem 2rem; font-weight: bold; @content; } .button-primary { @include button-style(blue) { color: white; text-transform: uppercase; } } .button-secondary { @include button-style(gray) { color: white; text-transform: uppercase; } }
@mixin button-style($color) { background-color: $color; border-radius: 0.5rem; padding: 1rem 2rem; font-weight: bold; // Repeating styles without @content color: white; text-transform: uppercase; } .button-primary { @include button-style(blue); color: white; text-transform: uppercase; } .button-secondary { @include button-style(gray); color: white; text-transform: uppercase; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Repeating styles without @content | No impact | No impact | No impact | [X] Bad - larger CSS bundle |
| Using @content to inject styles | No impact | No impact | No impact | [OK] Good - smaller CSS bundle |