Skip to content

Conversation

@LorenzoBloedow
Copy link

So here's the story:
After spending probably about 2 hours stuck on a bug where Tailwind would only log:

warn - No utility classes were detected in your source files. If this is unexpected, double-check the `content` option in your Tailwind CSS configuration.
warn - https://tailwindcss.com/docs/content-configuration

I finally realized that it was because I was using npx tailwindcss in an npm script (thus executing from package.json) while my tailwind config was actually nested in a lower directory (a test server).
When I went to the code that resolved the default path, I noticed that it wasn't logging anything, so I thought it'd be really helpful to log what happened so that it, hopefully, will save someone else some time in the future!

@RobinMalfait
Copy link
Member

We made some changes to master and had to force push which is why your branch looks a bit funny now. I don't have push rights on your branch, so if you want to fix it yourself then you can pull down the latest master branch and run git rebase master -X ours.

@LorenzoBloedow
Copy link
Author

you can pull down the latest master branch and run git rebase master -X ours.
I'm not gonna lie, currently I'm not the best at git but I gave it my best shot, hopefully didn't mess anything up

@LorenzoBloedow
Copy link
Author

@RobinMalfait can we merge this?

@RobinMalfait
Copy link
Member

Hey, thanks so much for this contribution! 🙏

We are working towards a future where a tailwind.config.js file shouldn't be necessary.

While the code technically works, it will also result in false-positive warnings right now, because the log will be shown if you don't have a tailwind.config.js file but do have a tailwind.config.ts file (notice the extension difference) which is still considered one of the default files we are looking for.

The code currently is making some assumptions (e.g.: use the --config flag), but this is only available in the CLI, not when integrating in other toolchains (e.g.: Next.js, Vite, ...)

I get that this can be confusing, but adding this error will cause more false positives and there is no way around if you do want to have no config file at all.

We already talked about a better way of exposing useful information when debugging setup related issues in the future.

Going to close this PR for now because of the aforementioned reasons.

Hope this helps, and thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants