Skip to content
Index

[Angular] Set up a new Angular project with Tailwind CSS

Tested with: Angular v19 • Tailwind CSS v4

  1. Use the Angular CLI to generate a barebones project.

    Terminal window
    npx @angular/cli@latest new --style css

    You will be prompted to choose a project name (i.e. folder name) and other options for your project.

  2. Navigate into the project directory.

    Terminal window
    cd <project-name>
  3. 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 postcss

    Create a .postcssrc.json file in the root of your project:

    .postcssrc.json
    {
    "plugins": {
    "@tailwindcss/postcss": {}
    }
    }

    Update your styles.css file to import Tailwind CSS:

    src/styles.css
    @import "tailwindcss";
  4. Start the development server.

    Terminal window
    npm run start
  5. Now you can use the Tailwind CSS classes in your Angular templates.