This project demonstrates the migration process from Tailwind CSS 3.14.7 to Tailwind CSS 4.0 in an Astro project.
This repository contains a step-by-step guide and example code for migrating an existing Astro project from Tailwind CSS 3.14.7 to the latest Tailwind CSS 4.0. The migration process is documented to help developers understand the changes and successfully upgrade their projects.
Before starting the migration, create a backup of your current Tailwind configuration and styles:
cp tailwind.config.js tailwind.config.backup.js
cp src/styles/tailwind.css src/styles/tailwind.backup.css
Use the official Tailwind CSS upgrade tool to automatically convert your configuration:
npx @tailwindcss/upgrade@next
This tool will perform several important tasks:
After running the upgrade tool, update your Tailwind CSS dependencies:
npm install tailwindcss@latest
All commands are run from the root of the project, from a terminal:
Command | Action |
---|---|
npm install |
Installs dependencies |
npm run dev |
Starts local dev server at localhost:4321 |
npm run build |
Build your production site to ./dist/ |
npm run preview |
Preview your build locally, before deploying |
npm run astro ... |
Run CLI commands like astro add , astro check |
npm run astro -- --help |
Get help using the Astro CLI |
If you encounter issues after migration:
For more detailed information about the migration process:
This project is licensed under the MIT License - see the LICENSE file for details.