--- name: features-upgrade description: Migrating from Tailwind CSS v3 to v4 --- # Upgrade Guide (v3 → v4) Key changes when upgrading from Tailwind CSS v3 to v4. Use the automated upgrade tool when possible. ## Upgrade Tool ```bash npx @tailwindcss/upgrade ``` Requires Node.js 20+. Run in a new branch, review diff, test. Handles most migration automatically. ## Installation Changes - **PostCSS**: Use `@tailwindcss/postcss`; remove `postcss-import` and `autoprefixer` (handled by v4) - **Vite**: Prefer `@tailwindcss/vite` over PostCSS - **CLI**: Use `npx @tailwindcss/cli` instead of `npx tailwindcss` ## Import Change ```css /* v3 */ @tailwind base; @tailwind components; @tailwind utilities; /* v4 */ @import "tailwindcss"; ``` ## Renamed Utilities | v3 | v4 | |----|-----| | `shadow-sm` | `shadow-xs` | | `shadow` | `shadow-sm` | | `rounded-sm` | `rounded-xs` | | `rounded` | `rounded-sm` | | `blur-sm` | `blur-xs` | | `blur` | `blur-sm` | | `outline-none` | `outline-hidden` | | `ring` | `ring-3` | ## Removed / Replaced - `bg-opacity-*`, `text-opacity-*`, etc. → use `bg-black/50`, `text-black/50` - `flex-shrink-*` → `shrink-*` - `flex-grow-*` → `grow-*` - `overflow-ellipsis` → `text-ellipsis` ## Important Modifier ```html