Asset minification options (CSS)

I’m handling my CSS as a Hugo Resource.

Minification (ex. hugo --minify or resources.Get "styles/main.scss" | resources.ToCSS | resources.Minify) with Hugo causes some of my CSS to be altered, reducing the support I had planned.

I always minify my site with hugo --minify, but that also alters any CSS embedded in the HTML.

For example, rgba(rr, gg, bb, aa) is translated to #rrggbbaa hex notation, which has less support.

Such conversion is not intended, so how can I configure Hugo’s minification behavior?

It’s tempting to focus on your example here to dismiss your concern :slight_smile: Long time I didn’t see a caniuse chart soooo green.

To answer your question, no there is no way to pass your own settings to the minify feature, either the --minify cli flag or the resources.Minify method.

1 Like

@regis that caniuse chart actually gives me 79.11% coverage for #rrggbbaa support – leaving out 1/5 users. Not great for a minor minification gain…

If I could only minify the html with Hugo, and not the CSS embedded in the HTML, that would be nice. I would handle the CSS with an external tool, like gulp.

Anyway, I got my answer – no control over minification behavior.

I’m sorry I was a bit cocky here.

For this specific issue though, the team is rooting for you: