Performance: @else and @else if branches
LOW IMPACT
This affects CSS compilation time and the size of the generated CSS file, which impacts page load speed.
@if $font-scale >= 1.5 { h1 { font-size: 3rem; } } @else if $font-scale >= 1.0 { h1 { font-size: 2rem; } }
@if $font-scale >= 1.5 { h1 { font-size: 3rem; } } @if $font-scale >= 1.0 { h1 { font-size: 2rem; } }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Separate @if statements | N/A | N/A | Larger CSS file increases parsing time | [X] Bad |
| @if with @else if branches | N/A | N/A | Smaller CSS file reduces parsing time | [OK] Good |