Migrate from Tailwind CSS v3 to v4
Author: dougaitkenCreated Feb 15, 2026Updated Feb 15, 2026
Labelsenhancement
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.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 - Custom plugins — Two inline plugins emit CSS custom properties (
:rootvars) and custom utility classes (flow-space-*,region-space-*,gutter-*). These need rewriting as@utilitydirectives or kept via@plugin corePluginsdisabled — We disablepreflight,textOpacity,backgroundOpacity, andborderOpacity. ThecorePluginsoption is removed in v4 with no direct equivalent- PostCSS dependencies — Currently uses
postcss-import,postcss-import-ext-glob,postcss-js, andautoprefixer, all of which get replaced by a single@tailwindcss/postcssplugin
General Breaking Changes to Be Aware Of
- JS config → CSS
@theme—tailwind.config.jsno longer auto-detected - PostCSS simplification —
tailwindcss+postcss-import+autoprefixerreplaced 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 now1px - 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/upgradeto see what it handles automatically - Keep the JS config via
@configinitially for the token pipeline - Gradually migrate to pure CSS
@themedefinitions (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
Source: remoteintech/remote-jobs