Open doompadee opened 1 year ago
@doompadee so I do agree that this would be nice, but extracting classes from JS is a harder nut to crack.
We could consider looking at how Tailwind has approached this in their recent 3.x version. I think they collect "string identifiers" and does not care about what they are, which I guess is good enough for the prime use case here.
With the new tailwind support (https://github.com/gohugoio/hugo/commit/e1317dd32281dc5ce670e34165dc7780c8f5892b) this issue should be gone?
@doompadee not really. With the "old" Tailwind support, you could configure a set of folders or files for which to extract identifiers. So, you could/can point to where your JS files lives (e.g. assets
). This works great in mono repo setups, but not so much in more complex setups.
Currently hugo_stats.json only includes elements found in the project .html files. But it's not uncommon to use HTML classes in JavaScript files as well (via
element.classList.add()
) and it would be helpful if Hugo could extract these as well.