Cannot purge unused CSS in Hugo site with Tailwind

I am working on a Hugo site that uses Tailwind CSS. I followed the instructions in this post so I can purge unused CSS.

It works fine in my computer, however I cannot make it work on render, it does not purge the unused CSS styles.

To make it work in my computer I only run NODE_ENV=production hugo, however that command does not compress my CSS on render.

Any idea? I can share my git repo if needed.

Thanks in advance for any help.

Hi @hectorsq welcome to the Render community! Can you share a link to the service so I can take a look? In the meantime, can you try setting NODE_ENV=production in the Environment tab on your dashboard?

@hectorsq, after following that tutorial myself I had to set my Build command in my settings to NODE_ENV=production hugo --gc --minify and it looks like it successfully purged and minified.

Let me know if that works for you!

@tyler Thank you very much for your help, I reviewed your site, and it is working fine. The CSS is only 4.56 KB.

I will try again following the tutorial step by step. It seems that I missed something when applying the steps to my own site.

I finally found the problem. My original project has a custom theme where I moved the layouts and assets. However, I missed configuring the theme layout folder in the purge section of tailwind.config.js

The final content of tailwind.config.js is

module.exports = {
  purge: [
  darkMode: false, // or 'media' or 'class'
  theme: {
    extend: {},
  variants: {
    extend: {},
  plugins: [],

The complete code is here, and the running site is here.