A minimal Angular 19 project with Tailwind CSS 4 wired in through PostCSS, ready to use as a template.
- Angular 19.1 with standalone components (no NgModules), the
applicationbuilder and a router config ready to fill in. - Tailwind CSS 4.0 set up the v4 way: no
tailwind.config.js, just the@tailwindcss/postcssplugin in.postcssrc.jsonand@import "tailwindcss";insrc/styles.css. - A single
AppComponentthat renders a heading styled with Tailwind utility classes, so you can confirm the setup works. - Karma and Jasmine for unit tests, as generated by the Angular CLI.
- A
.npmrcwithlegacy-peer-deps=true. Angular 19.1's build package lists Tailwind 2 or 3 as an optional peer, so npm refuses to install Tailwind 4 without it.
.postcssrc.json:
{
"plugins": {
"@tailwindcss/postcss": {}
}
}src/styles.css:
@import "tailwindcss";The Angular build picks up the PostCSS config automatically. Tailwind 4 scans your templates for class names on its own, so there is no content list to maintain. To customize the theme, add an @theme { ... } block in src/styles.css.
-
Clone it into a new folder:
git clone https://github.com/manthanank/angular-tailwindcss.git my-app cd my-app rm -rf .git && git init
-
Rename the project: change
nameinpackage.jsonand theangular-tailwindcssproject key inangular.json. -
Replace the contents of
src/app/app.component.htmlwith your own markup and start adding components and routes (src/app/app.routes.ts).
Requires Node.js 18.19 or later.
npm ci
npm startThen open http://localhost:4200/. The page reloads when you change a source file.
| Command | What it does |
|---|---|
npm start |
Runs ng serve, the dev server on port 4200 |
npm run build |
Production build into dist/angular-tailwindcss/ |
npm run watch |
Development build that rebuilds on file changes |
npm test |
Runs the unit tests with Karma in Chrome |
npm run ng -- <command> |
Any other Angular CLI command, for example npm run ng -- generate component header |