Tailwind v4 alpha
Astro ^4.0.0
Tailwind 4.0 plans to introduce some big changes, including a new Vite plugin, which will improve accuracy and performance.
On top of the Vite plugin v4 comes with some major changes, most notably a redesign of the tailwind.config.mjs
. The plan is to continue to support using the existing configs, but steer users toward using the entry point .css
file as the config file.
Setup
-
Install Tailwind’s official Vite plugin
-
Add the plugin to Astro config and enable Lightning CSS
-
Import the CSS file that imports Tailwind into your
.astro
componentsInstead of Astro’s Tailwind integration importing the default Tailwind
.css
file for you, you’ll need to do this yourself. Either import this.css
file into a shared layout, or into the individual.astro
components/pages you’d like to use Tailwind in.