Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Last time I tried v4 the automatic content detection was pretty bad. It would falsely detect tailwind classes if it seen a similar name in a string in a code file. It seemed pretty dumb.


That is more or less how it worked in v3 already, because any string could be used as a CSS class.

"The way Tailwind scans your source code for classes is intentionally very simple — we don’t actually parse or execute any of your code in the language it’s written in, we just use regular expressions to extract every string that could possibly be a class name."

https://v3.tailwindcss.com/docs/content-configuration#class-...

The only difference in v4 is that scanning is so fast, they just scan roughly everything by default. You can still opt into manually specifying which files to scan.

https://tailwindcss.com/docs/detecting-classes-in-source-fil...


In v3, one can use `blocklist` in the config to eliminate false-positives, but with the config file gone, this seems no longer possible, so I won't be upgrading.

In one project, roughly 75% of the detections were false-positives, unnecessarily bloating the CSS.


You can disable automatic detection and manually configure which files to look at:

https://tailwindcss.com/docs/detecting-classes-in-source-fil...


This seems like the best path forward if you're using v4.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: