HomeBlogCSS
CSS

Tailwind CSS v4: What's New and What's Gone

A complete breakdown of Tailwind CSS v4 — the new CSS-first config, @theme blocks, the removed JIT mode, performance improvements, and the migration path from v3.

Sep 10, 2024 7 min read 38.7k views
Tailwind CSS CSS Frontend v4

Tailwind CSS v4 is the most significant rewrite since the project launched. The PostCSS plugin architecture is gone. The javascript config file is gone. The JIT engine is gone — replaced by a new Rust-based engine that's 10x faster. Here's everything that changed and what it means for your projects.

CSS-First Configuration with @theme

The tailwind.config.js file is replaced by an @theme block in your CSS file. Your design tokens are now CSS custom properties, which means they're available to non-Tailwind code too — no more duplicating your color palette between JS and CSS.

css
@import "tailwindcss";

@theme {
  --color-primary: #00d4ff;
  --color-primary-dark: #0099bb;
  --font-display: 'Syne', sans-serif;
  --font-mono: 'Space Mono', monospace;
  --spacing-18: 4.5rem;
}
⚠️ Warning

The @theme block is NOT the same as :root. Variables defined in @theme are registered as Tailwind design tokens and generate utility classes. Variables in :root are just CSS custom properties.

The New Engine: No PostCSS Required

The v4 engine is a single binary — no PostCSS, no autoprefixer, no plugins. It scans your files at near-native speed and generates only the CSS you use. In benchmarks, a large project that took 800ms to build with v3 JIT now builds in 80ms.

Breaking Changes to Watch

Several utility names changed: ring is now outline, shadow-sm is now shadow-xs, and the default border color changed from gray-200 to currentColor. The migration guide covers all breaking changes, and the official upgrade tool handles most of them automatically.

bash
# Run the official migration codemod
npx @tailwindcss/upgrade@next

# Then check the diff carefully —
# some changes require manual review

Found this useful?

Share it with your network