How to minify assets only when --minify is used

Hello,

I’m trying to minify assets only when the --minify flag is used, but I could not find a way to know whether the flag was used from within the template. Any idea?

Thanks!

That is not possible. You can however use the .Site.IsServer variable to determine if the site is compiled using hugo server (true) or not (false). If you are deploying on Netlify it’s netlify.toml is able to help you define environments and set params only per environment. If you deploy on any other service they might have customized ways to determine “where” you are and what to do. Hugo itself has the --environment parameter that you can use to define “where” you are.