Performance: Tailwind CSS integration
Tailwind CSS integration affects page load speed by adding CSS bundle size and impacts rendering performance through utility class usage and style recalculations.
/* astro.config.mjs */ import tailwind from '@astrojs/tailwind'; export default { integrations: [tailwind({ config: './tailwind.config.js' })], }; /* tailwind.config.js */ module.exports = { content: ['./src/**/*.{astro,js,jsx,ts,tsx}'], theme: { extend: {} }, plugins: [], }; /* Content paths configured, only used styles included */
/* astro.config.mjs */ import tailwind from '@astrojs/tailwind'; export default { integrations: [tailwind({ config: './tailwind.config.js' })], }; /* tailwind.config.js */ module.exports = { theme: { extend: {} }, plugins: [], }; /* No content paths configured, large CSS bundle generated */
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Tailwind without content paths | Minimal DOM impact | 0 reflows from CSS itself | High paint cost due to large CSS | [X] Bad |
| Tailwind with content paths | Minimal DOM impact | 0 reflows from CSS itself | Low paint cost with small CSS | [OK] Good |
<div class="bg-blue-500 text-white p-4 rounded">Hello Astro</div>
Pass the test and this pattern moves unknown