Diagnosing Missing Tailwind CSS Utility Classes Due to Content Configuration
Learn how to spot missing Tailwind utilities, verify your content paths, and fix the JIT scanner so classes like flex and text‑red‑500 appear in the generated CSS.
11 Oct 2025, 21:01 UTC

Recognizable condition
After building or watching the project, certain Tailwind utility classes such as flex, text-red-500, or hover:bg-blue-600 are missing from the generated CSS file, causing elements to appear unstyled or using fallback styles.
Cause / diagnostic table
| Symptom | Likely cause |
|---|---|
Specific utilities absent from build/css/tailwind.css | Content paths in tailwind.config.js do not match the locations of your template files |
| All utilities missing | Content array empty or pointing to wrong root |
| Only utilities from certain directories missing | Glob pattern excludes those directories or uses overly restrictive exclude |
Ordered checks
- Open
tailwind.config.jsand verify thecontentarray includes every directory or glob that contains HTML, JSX, Vue, Svelte, or other templated files. - Ensure each path is relative to the project root and uses correct glob syntax (e.g.,
./src/**/*.{html,js,jsx,ts,tsx,vue}). - Run Tailwind in watch mode with debug output to see which files are being scanned:
Look for lines likeTAILWIND_MODE=watch npx tailwindcss -i ./src/input.css -o ./dist/tailwind.css --watchScanning ...in the terminal. - Inspect the generated CSS file (e.g.,
dist/tailwind.css) for the missing utility. Usegrepto confirm:
If the line returns nothing, the class was purged.grep '\\bflex\\b' dist/tailwind.css - As a quick test, temporarily replace the
contentarray with[ '*/*' ]and rebuild. If the missing utilities appear, the issue is definitely a content‑path mismatch.
Fixes tied to findings
Add missing paths or correct globs
Edit tailwind.config.js to include the missing directories. Example:
module.exports = {
content: [
'./src/**/*.{html,js,jsx,ts,tsx,vue}',
'./public/**/*.html',
'./components/**/*.{js,jsx,ts,tsx,vue}'
],
theme: {
extend: {},
},
plugins: [],
};
Save the file and restart the development server or rebuild the production bundle.
Remove overly restrictive exclusions
If you have an exclude property, verify it does not unintentionally filter out needed files:
module.exports = {
content: {
raw: [
'./src/**/*.{html,js,jsx,ts,tsx,vue}'
],
exclude: [] // ensure no needed paths are listed here
},
// …
};
Restart the scanner
Changes to tailwind.config.js are only picked up after the Tailwind JIT process restarts. Stop any running npm run dev or yarn dev process and start it again, or run a fresh build:
npm run build
Escalation criteria
If the missing utilities still do not appear after verifying and correcting the content array:
- Check for custom extractors or safelist configurations that might be overriding class usage. Look for
safelistintailwind.config.jsand ensure it does not inadvertently whitelist only a subset. - Confirm that the version of Tailwind CSS you are using is compatible with the PostCSS plugin version. A mismatch can cause the JIT scanner to ignore the
contentsetting. - Exclude any third‑party CSS processing steps (e.g., PurgeCSS separate from Tailwind) that could be stripping utilities after Tailwind generates them.
- If you are using a monorepo or workspace, verify that the
contentpaths are resolved correctly from the workspace root; you may need to usepath.resolveor relative paths from the config file’s location.
After applying any of the above steps, repeat the verification checks (grep the generated CSS and reload the browser) to confirm the utility is present and the styling appears as expected.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.