Performance: Built-in math functions
LOW IMPACT
Using built-in math functions in Sass affects the CSS compilation speed and the final CSS size, impacting page load time.
@use "sass:math"; $width: math.add(100px, 50px); $height: math.multiply(200px, 2); .box { width: #{$width}; height: #{$height}; }
$width: 100px + 50px; $height: 200px * 2; .box { width: calc(100px + 50px); height: calc(200px * 2); }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Using CSS calc() for fixed values | 0 | 1+ at runtime | Medium due to layout recalculation | [X] Bad |
| Using Sass built-in math functions | 0 | 0 at runtime | Low, precomputed values | [OK] Good |