"Netlify build" doesn't minify Hugo site, --minify not applied from netlify.toml

Maybe this a basic question, but I was wondering why when I run:

  • netlify build
  • netlify deploy

The code is not minified, even though in my Hugo netlify.toml file I have:

[build]
  publish = "public/"
  command = "hugo --debug --minify"
[build.environment]  
  NODE_ENV = "production"
  HUGO_VERSION = "0.105.0"

How can I ensure --minify is executed?

This is the site: https://bullaki.netlify.app/

Thank you :slight_smile:

@SL654 Your HTML does seem to be minified?

I’ve only had a quick look at the Hugo docs, but as I understand it --minify only minifies the HTML.

1 Like

Hi @SL654 :wave:t6: welcome back to the forums. Your HTML is minified. Can you clarify what you you are referring to?

Here a repo that you can reference for setting up minify- GitHub - philhawksworth/netlify-plugin-minify-html

Thanks guys. Yes, HTML is minified, I got fooled by the highlight.js file, which I’ve imported from the CND and it isn’t minified. The rest of *.js seems to be minified through “esbuild”. So I guess, problem solved!

yay! glad to hear it.