Performance: CSS imports per route
MEDIUM IMPACT
This affects the page load speed by controlling how much CSS is loaded initially and when navigating between routes.
import './global.css'; export function links() { return [{ rel: 'stylesheet', href: '/global.css' }]; } // In routeA.jsx import './routeA.css'; export function links() { return [{ rel: 'stylesheet', href: '/routeA.css' }]; } // In routeB.jsx import './routeB.css'; export function links() { return [{ rel: 'stylesheet', href: '/routeB.css' }]; }
import './global.css'; import './routeA.css'; import './routeB.css'; export function links() { return [ { rel: 'stylesheet', href: '/global.css' }, { rel: 'stylesheet', href: '/routeA.css' }, { rel: 'stylesheet', href: '/routeB.css' } ]; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Global CSS import for all routes | Minimal | 1 per route load | High due to large CSS | [X] Bad |
| Route-specific CSS imports | Minimal | 1 per route load | Low due to smaller CSS | [OK] Good |