Hey community! I work with a website built with Hugo that has thousands of pages. And I’ve been looking into the possibility to migrate the utility classes used there to tailwind’s.
So I’m working in the implementation, tailwind is watching hugo stats file, and everything works perfectly on local.
Now, I’m trying to avoid adding the hugo_stats.json file to the repository as it is huge and auto-generated. And the problem that I’m having is that at least from what I understand (and how it behaves when deployed), the site needs to rebuild in production after generating the hugo_stats.json file to pick up tailwind classes.
After diving into a bunch of example repositories, reading every documentation and blog post I could find and looking for posts here, it’s still unclear to me how/if there’s a way for tailwind to pick up the classes without a rebuilding or committing the stats file. If anybody could give me an insight on this I would really appreciate.
We use SASS for general styling, and we have plans on updating Hugo, but for now we are using v0.121.0.
Note that “earlier” I recommended to not use resources.PostProcess in development/server, which is where you see these rebuilds when the hugo_stats.json changes. We have a much better setup in newer Hugo (not remember when we fixed that, but it was a preparation for Tailwind 4 which is still in alpha).
I can add that you don’t have to use the hugo_stats.json to get Tailwind up and running, but it’s convenient.
That said, the overhead of creating the hugo_stats.json should be very small.
Fair.
I was reading resources.PostCSS everywhere, missing the resources.PostProcess in the examples until you mentioned it. That was indeed the answer.