Inside of your Astro project, you'll see the following folders and files:
/
├── public/
│ └── favicon.svg
├── src/
│ ├── layouts/
│ │ └── Layout.astro
│ ├── pages/
│ │ └── index.astro
│ ├── components/
│ │
│ ├── styles/
│ │ └── global.css
│ └── assets/
└── package.json
To learn more about the folder structure of an Astro project, refer to our guide on project structure.
All commands are run from the root of the project, from a terminal:
Command | Action |
---|---|
yarn install |
Installs dependencies using Yarn |
yarn dev |
Starts local dev server at localhost:4321 using Yarn |
yarn build |
Build your production site to ./dist/ using Yarn |
yarn preview |
Preview your build locally, before deploying using Yarn |
yarn astro ... |
Run CLI commands like astro add , astro check using Yarn |
yarn astro --help |
Get help using the Astro CLI using Yarn |
Feel free to check our documentation or jump into our Discord server.
To add TailwindCSS to your Astro project, follow these steps:
-
Install TailwindCSS and its peer dependencies:
yarn add @tailwindcss/vite
-
Configure Vite Plugin
import { defineConfig } from "astro/config"; import tailwindcss from "@tailwindcss/vite"; // https://astro.build/config export default defineConfig({ vite: { plugins: [tailwindcss()], }, });
-
Add the following to your main CSS file (e.g.,
src/styles/global.css
):@import "tailwindcss";
-
Import the CSS file in your
src/pages/index.astro
:--- import '../styles/global.css'; ---
Now you can use TailwindCSS classes in your Astro components.