Summary
Tailwind CSS v4 is a ground-up rewrite of the framework, released January 2025. It replaces the JavaScript-based configuration system with a CSS-first approach, uses a new high-performance engine built on Lightning CSS, and leverages modern CSS features (@property, color-mix()).
v3 will eventually stop receiving updates, so we need to migrate at some point. This issue tracks the effort.
Why This Isn't a Quick Upgrade
Our project uses Tailwind in an unconventional way — as a design token processor under the CUBE CSS methodology, not as a traditional utility-class framework. This makes several of the breaking changes particularly impactful for us.
Project-Specific Challenges
- Design token pipeline —
tailwind.config.js imports JSON token files and processes them through tokensToTailwind() and clampGenerator(). These would need to be converted to CSS @theme variables or the JS config retained via @config
- Custom plugins — Two inline plugins emit CSS custom properties (
:root vars) and custom utility classes (flow-space-*, region-space-*, gutter-*). These need rewriting as @utility directives or kept via @plugin
corePlugins disabled — We disable preflight, textOpacity, backgroundOpacity, and borderOpacity. The corePlugins option is removed in v4 with no direct equivalent
- PostCSS dependencies — Currently uses
postcss-import, postcss-import-ext-glob, postcss-js, and autoprefixer, all of which get replaced by a single @tailwindcss/postcss plugin
General Breaking Changes to Be Aware Of
- JS config → CSS
@theme — tailwind.config.js no longer auto-detected
- PostCSS simplification —
tailwindcss + postcss-import + autoprefixer replaced by @tailwindcss/postcss
- Renamed utilities — shadow/blur/rounded scales shifted (e.g.
shadow-sm → shadow-xs), !flex → flex!
- Opacity utilities removed — replaced by modifier syntax (
bg-blue-500/50)
- Default value changes — border color now
currentColor, ring width now 1px
- Requires modern browsers — Safari 16.4+, Chrome 111+, Firefox 128+
- No Sass/Less/Stylus support — Tailwind is the preprocessor now
Suggested Approach
- Create a feature branch
- Run
npx @tailwindcss/upgrade to see what it handles automatically
- Keep the JS config via
@config initially for the token pipeline
- Gradually migrate to pure CSS
@theme definitions (v4 auto-exposes all theme values as CSS variables, which may eliminate much of our custom plugin code)
- Audit and update any renamed utility classes in templates
- Remove obsolete PostCSS dependencies
- Thorough visual regression testing across the site
References
Summary
Tailwind CSS v4 is a ground-up rewrite of the framework, released January 2025. It replaces the JavaScript-based configuration system with a CSS-first approach, uses a new high-performance engine built on Lightning CSS, and leverages modern CSS features (
@property,color-mix()).v3 will eventually stop receiving updates, so we need to migrate at some point. This issue tracks the effort.
Why This Isn't a Quick Upgrade
Our project uses Tailwind in an unconventional way — as a design token processor under the CUBE CSS methodology, not as a traditional utility-class framework. This makes several of the breaking changes particularly impactful for us.
Project-Specific Challenges
tailwind.config.jsimports JSON token files and processes them throughtokensToTailwind()andclampGenerator(). These would need to be converted to CSS@themevariables or the JS config retained via@config:rootvars) and custom utility classes (flow-space-*,region-space-*,gutter-*). These need rewriting as@utilitydirectives or kept via@plugincorePluginsdisabled — We disablepreflight,textOpacity,backgroundOpacity, andborderOpacity. ThecorePluginsoption is removed in v4 with no direct equivalentpostcss-import,postcss-import-ext-glob,postcss-js, andautoprefixer, all of which get replaced by a single@tailwindcss/postcsspluginGeneral Breaking Changes to Be Aware Of
@theme—tailwind.config.jsno longer auto-detectedtailwindcss+postcss-import+autoprefixerreplaced by@tailwindcss/postcssshadow-sm→shadow-xs),!flex→flex!bg-blue-500/50)currentColor, ring width now1pxSuggested Approach
npx @tailwindcss/upgradeto see what it handles automatically@configinitially for the token pipeline@themedefinitions (v4 auto-exposes all theme values as CSS variables, which may eliminate much of our custom plugin code)References