# Tailwind CSS v3 to v4 Migration Guide This guide documents the process for upgrading VibeTunnel from Tailwind CSS v3 to v4. ## Current Status VibeTunnel currently uses Tailwind CSS v3.4.17 (see `web/package.json:152`). ## Prerequisites - **Node.js 20 or higher** - The upgrade tool requires Node.js 20+ - **Clean git branch** - Always run the migration in a new branch - **All changes committed** - Ensure your working directory is clean ## Automated Migration Tailwind provides an automated upgrade tool that handles most of the migration: ```bash cd web npx @tailwindcss/upgrade@next ``` ### What the Tool Does The upgrade tool automatically: - Updates dependencies to v4 - Migrates `tailwind.config.js` to CSS format - Updates template files for breaking changes - Converts deprecated utilities to modern alternatives - Updates import statements ### Important Notes - The tool only works on v3 projects. If you've partially upgraded, it will refuse to run - To re-run after a partial upgrade, first reinstall v3: `npm install tailwindcss@3` - Run in a new git branch to easily review changes - Expect to spend 2-4 hours on migration for a medium project ## Major Changes in v4 ### 1. CSS Import Syntax **Before (v3):** ```css @tailwind base; @tailwind components; @tailwind utilities; ``` **After (v4):** ```css @import "tailwindcss"; ``` ### 2. Configuration Changes - `tailwind.config.js` is no longer needed - Configuration moves to CSS using `@theme` and `@plugin` directives - Zero-config by default - just import and start using ### 3. Plugin Installation **Before (v3):** ```js // tailwind.config.js module.exports = { plugins: [ require('@tailwindcss/typography'), require('@tailwindcss/forms'), ] } ``` **After (v4):** ```css @import "tailwindcss"; @plugin "@tailwindcss/typography"; @plugin "@tailwindcss/forms"; ``` ### 4. Dark Mode Configuration **Default:** Uses `prefers-color-scheme` media query **For class-based dark mode:** ```css @import "tailwindcss"; @custom-variant dark (&:where(.dark, .dark *)); ``` ### 5. PostCSS Changes The PostCSS plugin moved to a separate package: ```bash npm install @tailwindcss/postcss ``` Update your PostCSS config to use the new package. ## Breaking Changes ### Removed Utilities Deprecated v3 utilities have been removed. The upgrade tool handles replacements automatically. ### CSS Variable Syntax **Before (v3):** ```html