Performance: Content configuration for tree-shaking
This affects the final CSS bundle size and page load speed by removing unused styles.
module.exports = {
content: ['./src/**/*.{js,jsx,ts,tsx,html}', './public/**/*.html'],
theme: { extend: {} },
plugins: [],
};module.exports = {
content: ['./src/**/*.{js,jsx,ts,tsx}'],
// missing some HTML or template files
theme: { extend: {} },
plugins: [],
};| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Incomplete content config | N/A | N/A | High due to large CSS | [X] Bad |
| Complete content config | N/A | N/A | Low due to small CSS | [OK] Good |
content configuration in Tailwind CSS?content setting tells Tailwind which files to look at for CSS class names.content array in tailwind.config.js for scanning HTML and JS files in the src folder?./src/**/*.{html,js} means all files ending with .html or .js in any folder inside src.content property expects an array of strings, so it must be wrapped in [ ].tailwind.config.js snippet:module.exports = {
content: ['./app/**/*.html'],
theme: { extend: {} },
plugins: [],
}** means any subfolder inside app, and *.html means all HTML files.app and any nested folders.content configuration?content.content is empty or wrong, Tailwind can't find used classes and keeps all styles.content paths are missing or incorrect, so Tailwind scans no files -> Option Csrc/components and your HTML files in public. Which content configuration is best?js, jsx, ts, tsx, so include these with a recursive glob../public/**/*.html to cover all HTML files in public and subfolders.Pass the test and this pattern moves unknown