Performance: Why Astro handles styles efficiently
MEDIUM IMPACT
Astro's style handling impacts page load speed and rendering performance by minimizing CSS sent and reducing style recalculations.
export const styles = ` .button { color: blue; } `; // Styles scoped and only included if component is used
import './global.css'; // All styles loaded globally regardless of usage
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Global CSS import | Low | Multiple reflows if styles change | High due to large CSS | [X] Bad |
| Scoped component CSS | Low | Single reflow | Low due to minimal CSS | [OK] Good |