Performance: Importing only needed components
This affects page load speed by reducing CSS and JavaScript bundle size, improving initial render time.
import 'bootstrap/scss/buttons.scss'; import 'bootstrap/js/dist/button.js';
import 'bootstrap/dist/css/bootstrap.min.css'; import 'bootstrap/dist/js/bootstrap.bundle.min.js';
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Import full Bootstrap CSS and JS | No direct DOM impact | Triggers 1 reflow after full CSS load | High paint cost due to large styles | [X] Bad |
| Import only needed Bootstrap components | No direct DOM impact | Single reflow with minimal styles | Low paint cost with smaller CSS | [OK] Good |
@import 'bootstrap/scss/buttons'; @import 'bootstrap/scss/forms';
@import 'bootstrap/scss/button';
Pass the test and this pattern moves unknown