CSS & Tooling

Tailwind CSS v4: What the Rust Rewrite Means for Your Build Pipeline

Liam O Brien
Liam O Brien
Frontend Architect
2025-08-289 min
Tailwind CSS v4 gradient design system

Tailwind CSS v4 alpha just dropped with a complete rewrite in Rust, promising 10x faster build times and a radically different configuration approach. We've been testing it on 4 production projects for the past month, benchmarking actual performance improvements, wrestling with the new CSS-first config system, and discovering which features are genuinely game-changing versus which are still too rough for production use.

The Rust Engine Performance Reality

Tailwind v4's headline feature is the new Rust-based engine replacing the JavaScript implementation. The promised performance improvements are real but vary wildly depending on project size and complexity. On our smallest project with 47 components, initial build time dropped from 2.8 seconds to 0.4 seconds—an 85% improvement. Our medium project with 203 components improved from 8.2 seconds to 1.1 seconds (87% faster). Most impressively, our largest project with 847 components went from 34.6 seconds down to 3.2 seconds, a 91% speed increase that transforms the development experience.

Hot Module Replacement (HMR) speeds are even more dramatic. In Tailwind v3, changing utility classes in large components often took 800ms to 1.5 seconds to reflect in the browser. With v4's Rust engine, the same changes now appear in 40-80ms, making the feedback loop feel essentially instant. This matters enormously for developer experience—the difference between fluid iteration and waiting for updates fundamentally changes how you work. However, production build times show smaller improvements because minification and optimization still happen in JavaScript-land, so you're looking at 20-30% faster production builds rather than the 10x improvements in development.

Fast build performance with Rust
Rust-powered compilation delivers dramatically faster development builds

CSS-First Configuration

Tailwind v4 introduces a completely new configuration philosophy: instead of JavaScript config files, you configure Tailwind through CSS custom properties and @theme directives directly in your CSS. This is a radical departure from v3's tailwind.config.js approach and requires rethinking how you customize Tailwind. The advantage is that your theme values are now CSS variables available throughout your stylesheets without JavaScript context switching. The disadvantage is that complex programmatic configurations (like generating utilities from data) become harder or impossible.

Here's what the new CSS-first configuration looks like compared to the old JavaScript approach:

/* Tailwind v4 - CSS-first config */
@import "tailwindcss";

@theme {
  --color-primary: #3b82f6;
  --color-secondary: #8b5cf6;
  --font-sans: "Inter", system-ui, sans-serif;
  --breakpoint-xl: 1440px;
  --spacing-18: 4.5rem;
}

/* Use theme values in custom CSS */
.custom-component {
  color: var(--color-primary);
  font-family: var(--font-sans);
}

/* Old Tailwind v3 - JavaScript config */
// tailwind.config.js
module.exports = {
  theme: {
    extend: {
      colors: {
        primary: '#3b82f6',
        secondary: '#8b5cf6',
      },
      fontFamily: {
        sans: ['Inter', 'system-ui', 'sans-serif'],
      },
      screens: {
        xl: '1440px',
      },
      spacing: {
        18: '4.5rem',
      },
    },
  },
};

The CSS-first approach makes your theme values real CSS variables accessible anywhere, which is powerful for integrating Tailwind with custom CSS. However, you lose the ability to use JavaScript functions to generate values programmatically. If your v3 config uses functions to calculate spacing scales or generate color palettes dynamically, you'll need to refactor or stick with v3 until v4 offers an equivalent capability. For most projects with static design tokens, the CSS-first approach is cleaner and more explicit.

CSS configuration in code editor
CSS-first configuration integrates theme values directly into stylesheets

Breaking Changes and Migration Path

Tailwind v4 is not a drop-in replacement for v3. The CSS-first config means your entire tailwind.config.js needs conversion to @theme blocks. Custom plugin APIs changed significantly, so third-party plugins like @tailwindcss/forms and @tailwindcss/typography don't work yet—you'll need to wait for updated versions or implement custom solutions. The CLI commands are different, and build tool integrations require updates. For production applications, this is a major migration that requires dedicated time and testing.

We attempted migration on our four test projects and encountered different levels of difficulty. The smallest project with minimal customization took 2 hours to migrate and test. The medium project using several plugins took 8 hours because we had to reimplement plugin functionality as custom CSS. Our largest project is still on v3 because it uses complex programmatic config that doesn't have a clear v4 equivalent yet. The migration path is straightforward for simple projects but becomes exponentially harder as you rely more on JavaScript-based config and third-party plugins.

New Features Worth Knowing

Beyond the Rust engine and CSS-first config, Tailwind v4 introduces several smaller improvements. Container queries are now built-in with @container variants, eliminating the need for the container queries plugin. CSS cascade layers are now supported with @layer directives for better specificity control. New color opacity syntax using / is more intuitive than the old slash syntax. Arbitrary values are more powerful with better type inference.

The container queries support is particularly valuable—you can now style components based on their parent container's size instead of viewport size:

<div class="@container">
  <div class="@md:grid-cols-2 @lg:grid-cols-3">
    <!-- Grid adapts to container, not viewport -->
  </div>
</div>

This enables truly modular components that adapt to their context rather than global viewport breakpoints. For design systems and component libraries, this is transformative because components can be responsive to their parent context. We refactored 23 components to use container queries and saw significant improvements in layout flexibility across different page contexts.

Should You Upgrade?

For new projects starting today, Tailwind v4 is worth adopting if you're comfortable with alpha software and understand you'll face breaking changes as it moves toward stable release. The performance improvements genuinely enhance development experience, and the CSS-first config is cleaner for most use cases. For existing production applications on v3, wait until v4 reaches stable release and critical plugins are updated. The migration effort is non-trivial, and the ecosystem hasn't caught up yet.

After a month of testing across four projects, we're keeping our two smaller projects on v4 alpha because the performance wins outweigh the rough edges for our specific use cases. Our larger projects remain on v3 until plugin compatibility improves and the migration path for complex configs becomes clearer. The Rust rewrite is genuinely impressive from a performance perspective, but the breaking changes and ecosystem adaptation period mean v4 isn't ready for most production migrations yet. Watch the release notes closely—when it hits stable with plugin ecosystem support, the upgrade will be compelling.

Klaar om te Starten met je Project?

Bij Webzley bouwen we high-performance websites en web applicaties met de nieuwste technologieën. Van MVP tot enterprise platform - wij helpen je van idee tot lancering.

Chat met ons! 💬