Hugo ignoring Tailwind classes in a Typescript file

I copied the necessary files and the cachebusters code in the config file from this starter template, but I am noticing that the build ignores classes inside a typscript file (as in they don’t appear in the hugo stats file) (The TS file is converted to JS with Hugo pipes). Any recommended way to diagnose why this is happening?

So, the setup that’s in the starter template assumes that every class etc. is in the HTML, which isn’t always the case.

You need to in your tailwind.config.js file either add some more files to the content slice or add the classes used in your TS to the safelist (there are regexp options there):

module.exports = {
	content: ['./hugo_stats.json', 'some-other-file.ts'],
	safelist: [

Alright. This worked…

["./hugo_stats.json", "./**/**/assets/**/*.{ts,js}"]

Good to know now. I didn’t even notice until now, a week after adopting the setup.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.