I’ve run into a minor inconvenience. It’s that I’ve created a theme that have postcss, however my users have different Hugo environments. e.g. “internal” and “external”. This causes postcss to not work. In other words; I believe a potential solution to usecases like this can be to have a variable that I can use to see if the development server is running or if it’s a production build without checking HUGO_ENVIRONMENT variable as that can be anything set by the user.
So, in the templates, my current favourite pattern for this is:
{{ if not hugo.IsDevelopment }}
// minify, fingerprint etc.
{{ end }}
While the above, as you say, is not perfect, I find it is much better than IsServer because I want to test how “production looks” when running the server, so I do hugo server -e production– and that approach fails if my conditional uses IsServer.
I understand, but then the flexibility is lost. Say if I design my Hugo module to have any environment like “dev-external” to be able to run the configuration of such, then this will not work. In those cases something like .IsServer is preferred.