4 ms·
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 fi
by bitbasher 2y ago
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.
- dcre 2y agoThat 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-detection-in-depth 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-files#which-files-are-scanned https://tailwindcss.com/docs/detecting-classes-in-source-fil...
- silverwind 2y agoIn 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.
- dcre 2y agoYou can disable automatic detection and manually configure which files to look at: https://tailwindcss.com/docs/detecting-classes-in-source-files#disabling-automatic-detection https://tailwindcss.com/docs/detecting-classes-in-source-fil...
- bitbasher 2y agoThis seems like the best path forward if you're using v4.