Installation
Install Tailwind CSS with Astro
Setting up Tailwind CSS in an Astro project.
Create your project
Start by creating a new Astro project if you don't have one set up already. The most common approach is to use create astro.
Terminalnpm create astro@latest my-projectcd my-project
Install Tailwind CSS
Run the
astro add
command to install bothtailwindcss
and@astro/tailwind
as well as generate atailwind.config.cjs
file.Terminalnpx astro add tailwind
Start your build process
Run your build process with
npm run dev
.Terminalnpm run dev
Start using Tailwind in your project
Start using Tailwind's utility classes to style your content.
index.astro<h1 class="text-3xl font-bold underline"> Hello world! </h1>