Performance: Accessing map values with map-get
LOW IMPACT
This affects CSS preprocessing time, impacting initial page load speed.
$colors: (primary: #0055ff, secondary: #ff5500, accent: #00ffaa); $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: #00ffaa); .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 inline | 0 (preprocessing only) | 0 | 0 | [X] Bad |
| Caching map-get results in variables | 0 (preprocessing only) | 0 | 0 | [OK] Good |