Tailwind CSS classes not applied after upgrading to v4
poze 2 months ago65 gadeen
After upgrading Tailwind to v4, most of my styles are gone. My tailwind.config.js still lists content paths. What changed?
Dyagnostik IA
Se IA ki fè l. Se pa yon repons — kominote a anba a konfime oswa korije l. Toujou verifye anvan ou fye l.
1 Repons
Tailwind v4 changed the setup. Configuration moved into CSS, and content detection is automatic.
1. Replace the old @tailwind base; @tailwind components; @tailwind utilities; with a single import:
@import "tailwindcss";
2. Move theme customizations into CSS:
@theme {
--color-brand: #00209f;
--font-display: "Inter", sans-serif;
}
3. The PostCSS plugin is now @tailwindcss/postcss (or use @tailwindcss/vite).
4. To keep an existing JS config during migration, reference it with @config "./tailwind.config.js";.
Run npx @tailwindcss/upgrade in a clean git branch. It automates most of this, including renamed utilities.
Konekte pou di lòt moun si li te mache.
Sign in and verify your email to post an answer.