FrancescoDonzello
Angular Share on Twitter

Configure Tailwind

2 minutes read
#courses#angular

Welcome to this free course for learning how to create an enterprise Angular project from scratch by using only Standalone Components.

Add Tailwind

The Tailwind doc page does a really great job at describing how to setup your project. Let’s see all the required steps to successfully add Tailwind to our Angular Project.

Install all the required dependencies:

pnpm add -D tailwindcss postcss autoprefixer

Then initialize Tailwind:

pnpm dlx tailwindcss init

A note about dlx

pnpm dlx will download tailwindcss and execute the init command.

Configure tailwind.config.js:

tailwind.config.js
/** @type {import('tailwindcss').Config} */
module.exports = {
  content: [
    "./src/**/*.{html,ts}",
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}

Import Tailwind by modifying styles.scss:

style.scss
@tailwind base;
@tailwind components;
@tailwind utilities;

And we’re done!

You can now use all the cool features offered by Tailwind in your Angular project.

The Github Repo

You can find the source code of this step of the course right on GitHub.

What’s next

In the next chapter, we’ll see how to create our first Standalone Directive for the UI package.

Was it helpful?

Tell your friends or co-workers.