Performance: Built-in map functions
MEDIUM IMPACT
Using built-in map functions affects CSS preprocessing speed and the size of generated CSS, impacting initial page load and style calculation.
$colors: (primary: #0055ff, secondary: #ff5500, accent: #00ff55); $primary-color: map-get($colors, primary); $secondary-color: map-get($colors, secondary); $accent-color: map-get($colors, accent); .button { color: $primary-color; background-color: $secondary-color; border-color: $accent-color; }
$colors: (primary: #0055ff, secondary: #ff5500, accent: #00ff55); .button { color: map-get($colors, primary); background-color: map-get($colors, secondary); border-color: map-get($colors, accent); }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Repeated map-get calls | N/A (preprocessing only) | N/A | N/A | [X] Bad |
| Caching map values in variables | N/A (preprocessing only) | N/A | N/A | [OK] Good |