In fast render mode, if a new Tailwind utility class is introduced (e.g a padding) that is not in hugo_stats.json when the watcher is running, then it does not reflect unless the build is cancelled and restarted. I have been monitoring this issue for a few months now since it occurs randomly.
I am using Bep’s Hugo Tailwind Starter Template files/config btw.
The fast build might be the issue. The last case was triggered by a px-2.5 utility class that did not apply until I restarted the server. I would be curious to know which setting is that in the watcher.
Note that there may be cases where the classes does not end up in the stats file (e.g. dynamic classes from JS), but in general I have found that it works great.
In your case I would
Check if your px-2.5 class is written to the stat file
If yes, I would verify that your watcher/cache buster setup is correct.
This looks sensible to me and in line with what I’m actually using:
Is this necessary with recent Hugo versions? I had removed it.
This is what I found (without writeStats = true) with px-3.5—
DEBUG Rebuild for events ["WRITE \"C:\\\\Users\\\\arif\\\\hugo-site\\\\themes\\\\test\\\\layouts\\\\partials\\\\main\\\\meta.html\""]
DEBUG cachebuster: Matching "layouts/partials/main/meta.html" with source "assets/.*\\.(js|ts)": no match
DEBUG cachebuster: Matching "layouts/partials/main/meta.html" with source "assets/.*\\.(css|sass|scss)$": no match
DEBUG cachebuster: Matching "layouts/partials/main/meta.html" with source "(postcss|tailwind)\\.config\\.js": no match
DEBUG cachebuster: Matching "layouts/partials/main/meta.html" with source "assets/.*\\.(.*)$": no match
The class was added to hugo_stats.json but the style was not applied.
I see…so I have the new way configured…but still I’m not sure why the styles are not being applied. The config code I shared before was copied from here when I began seeing this issue.
EDIT: This code seems to work. The utility classes are applied. I will test further and see.