There are three issues about minification:
With _minify_ included it would also be easy to add minification for other formats. It also comes with support for CSS, HTML, JS, JSON, SVG and XML.
Personally I think it's currently a little bit tricky to find out about minification though.
It is definitely reasonable that files in static remain unchanged. Still, this would be the first place for be to put assets like CSS files.
If you want your styles minified you need to put them in the contents folder, which - as far as I could figure out - is not documented anywhere. The docs don't mention minification in an way.
Also, it would probably be good if users can disable/enable minifcation for the different file types.
What are your thoughts about adding further minifiers? And, is there existing documentation I didn't find?
These issues might also affect https://github.com/gohugoio/hugo/issues/621.
Minification out-of-the box is super useful in my opinion. Overall whitespace is wasting bandwidth and minified websites potentially load faster, especially if pages get "big". After all the "raw" HTML need to be transferred to the client so the smaller it can be the better.
I'd gladly welcome this feature and help test / document it if needed.
I'm currently working on "page bundles", which involves "redoing" the handler implementations; the current CSS minification I think was put in there kind of as a proof of concept, and I think I'm going to remove it in its current form. It will need some rethinking in a bigger picture.
@bep sorry, didn't see the work on page bundles. Feel free to close this issue if all above points have been already covered before.
@jorinvo it is in my repo, so I would be surprised if you saw it.
This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.
Hi! Now that Page Bundles have been implemented, I was wondering if there is interest in implementing minification support again?
I was reminded of this when I noticed that a new upstream version of golang-github-tdewolff-minify became available[1], and then I wondered why I packaged it for Debian in the first place[2].
and I was led back here. :-)
See also #4446
Hugo 0.43 added minification. I think this issue can be closed.
thanks for the hard work on this :)
Most helpful comment
Hi! Now that Page Bundles have been implemented, I was wondering if there is interest in implementing minification support again?
I was reminded of this when I noticed that a new upstream version of golang-github-tdewolff-minify became available[1], and then I wondered why I packaged it for Debian in the first place[2].
and I was led back here. :-)