0

When I build my Angular project I only sometimes get "No utility classes were detected in your source files." using tailwind, and sometimes it builds without warning but still no utilities. This happened all of a sudden, being built many times before, with working utilities. The base tailwind reset gets implemented in the styles, but not utilities..
It's also worth mentioning that classes i build from the styles with @apply works fine.

tailwind.config.js:

content: ["./src/**/*.{html,ts}"],

build command:

ng build --output-path docs

included in styles.css:

@tailwind base;
@tailwind components;
@tailwind utilities;

1 Answer 1

3

A coworker found a solution to this. For some unknown reason you have to include multiple file extensions to the tailwind config content string, even if they aren't used.

content: ["./src/**/*.{html,ts,tsx,jsx}"],
Sign up to request clarification or add additional context in comments.

4 Comments

You saved my day! Any explanation about what happened?
Good to hear! :) Still not sure why this happened specifically in Angular.
FYI: I faced today the same issue. Nothing in tailwind config was changed since last time. I've removed "tsx,jsx" since I don't have these kind of files, and then the build was fixed. Very strange.
This answer could explain that: stackoverflow.com/a/73231393/1409595

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.