Index
[Angular] Set up a new Angular project with Tailwind CSS
Tested with: Angular v19 • Tailwind CSS v4
-
Use the Angular CLI to generate a barebones project.
Terminal window npx @angular/cli@latest new --style cssYou will be prompted to choose a project name (i.e. folder name) and other options for your project.
-
Navigate into the project directory.
Terminal window cd <project-name> -
Install the necessary dependencies for Tailwind CSS, set up a new PostCSS config file, and update your stylesheet to import Tailwind.
Install dependencies:
Terminal window npm i -D tailwindcss @tailwindcss/postcss postcssTerminal window yarn add -D tailwindcss @tailwindcss/postcss postcssTerminal window pnpm add -D tailwindcss @tailwindcss/postcss postcssCreate a
.postcssrc.jsonfile in the root of your project:.postcssrc.json {"plugins": {"@tailwindcss/postcss": {}}}Update your
styles.cssfile to import Tailwind CSS:src/styles.css @import "tailwindcss"; -
Start the development server.
Terminal window npm run startTerminal window yarn run startTerminal window pnpm run start -
Now you can use the Tailwind CSS classes in your Angular templates.