Performance: Tailwind with Next.js
MEDIUM IMPACT
This affects page load speed and rendering performance by how CSS is generated, loaded, and applied in Next.js projects using Tailwind.
module.exports = {
mode: 'jit',
purge: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'],
// other config
};@import 'tailwindcss/base'; @import 'tailwindcss/components'; @import 'tailwindcss/utilities'; // No purge or JIT enabled in tailwind.config.js
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Tailwind without JIT and purge | Normal DOM | 1 reflow per style change | High paint cost due to large CSS | [X] Bad |
| Tailwind with JIT and purge in Next.js | Normal DOM | 1 reflow per style change | Low paint cost due to small CSS | [OK] Good |