Tailwind CSS v4: CSS-First Configuration and 5x Faster Builds

Tailwind CSS v4 replaces tailwind.config.js with a CSS-first `@theme` directive and swaps PostCSS for Lightning CSS — here is everything that changed and how to migrate.

Mahmudul Haque Qudrati — CEO & ML Engineer at Pristren

Mahmudul Haque Qudrati

CEO & ML Engineer

March 30, 2026
7 min read
Tailwind CSS v4: CSS-First Configuration and 5x Faster Builds

Tailwind CSS v4 Is a Complete Rethink

One AI engineering post, weekly

LLM benchmarks, prompt techniques, and token-cost breakdowns — not another AI news roundup.

Tailwind CSS v4 is not just an incremental update. It replaces the JavaScript configuration file with a CSS-first approach, swaps the PostCSS-based build pipeline for Lightning CSS, and introduces container queries, text shadows, and starting-style animations as first-class utilities.

CSS-First Configuration

The most visible change: no more tailwind.config.js. Configuration lives in your CSS file via the @theme directive:

css
/* Before (v3) — in tailwind.config.js */
/* module.exports = { theme: { extend: { colors: { brand: '#6366f1' } } } } */

/* After (v4) — directly in your CSS */
@import "tailwindcss";

@theme {
  --color-brand: #6366f1;
  --font-display: "Inter Variable", sans-serif;
  --radius-card: 12px;
  --spacing-18: 4.5rem;
}

Every @theme variable becomes a CSS custom property AND a Tailwind utility. After the above, you can write class="bg-brand text-brand" and class="rounded-card" immediately.

Team workspace

Ship faster with chat, meetings, and projects in one place — Zlyqor.

Start free

Lightning CSS Engine

Tailwind v4 ships with Lightning CSS (written in Rust) instead of PostCSS. Results:

  • 5x faster full builds
  • 100x faster incremental builds in watch mode
  • No PostCSS config file required
  • Vendor prefixes handled automatically
  • CSS nesting supported natively (no plugin)
bash
# v3 setup
pnpm add -D tailwindcss postcss autoprefixer
# + postcss.config.js required

# v4 setup — just Tailwind
pnpm add -D tailwindcss@next @tailwindcss/vite
# or for Next.js:
pnpm add -D tailwindcss@next @tailwindcss/postcss

Vite Plugin

For Vite-based projects, use the first-party Vite plugin instead of PostCSS:

typescript
// vite.config.ts
import tailwindcss from "@tailwindcss/vite";

export default {
  plugins: [tailwindcss()],
};

Container Queries — Built In

Container queries no longer require the @tailwindcss/container-queries plugin:

html
<div class="@container">
  <div class="@sm:flex-row flex-col flex gap-4">
    <!-- switches to row layout when parent ≥ 24rem -->
  </div>
</div>

Named containers:

html
<aside class="@container/sidebar">
  <nav class="@lg/sidebar:block hidden">...</nav>
</aside>

New Utility Classes

Text shadow — finally built in:

html
<h1 class="text-shadow-lg text-shadow-black/25">Heading</h1>

Starting style for CSS entry animations without JavaScript:

html
<div class="starting:opacity-0 transition-opacity duration-300 opacity-100">
  Fades in on first render
</div>

Migrating From v3

Most v3 projects need only a few changes:

bash
# Run the official migration tool
npx @tailwindcss/upgrade

What the tool does:

  1. Converts tailwind.config.js → @theme block in your CSS
  2. Replaces @tailwind base/components/utilities with @import "tailwindcss"
  3. Updates deprecated class names (shadow-sm → shadow-xs, etc.)
  4. Removes PostCSS config if you are using the Vite plugin

Manual check after migration: look for any plugins that used the JavaScript config API — those need to be rewritten for v4's CSS-based extension model.

References: Tailwind v4 blog · docs · upgrade guide

#tailwind-css-4#css-variables#lightning-css#configuration#performance

// discussion

Comments

0/4000
Mahmudul Haque Qudrati — CEO & ML Engineer at Pristren

Mahmudul Haque Qudrati

CEO & ML Engineer

Visionary technologist, software engineer, and machine learning specialist. Founder and CEO of Pristren, directing engineering teams that ship production-grade AI/ML pipelines, mission-critical full-stack applications, and developer tooling. Creator of Zlyqor, the unified team workspace platform. Author of 540+ technical guides and benchmark research reports on large language models, agentic workflows, Model Context Protocol (MCP), and modern web stacks.

PristrenZlyqor