Hugo: Add HTML tidying as an option

Created on 20 Apr 2020  路  4Comments  路  Source: gohugoio/hugo

https://gohugo.io/news/0.69.0-relnotes/

Given the hugo templating engine creates whitespace hell in output now that resources.PostProcess exists it would be awesome to have a similar hook to tidy the output HTML.

Here's a great Go lib that does it perfectly https://github.com/yosssi/gohtml

Enhancement

Most helpful comment

You're right, the HTML output from Go templates leave much to be desired ...

Note that I think this should be implemented in the same place as we do output minification. PostProcess is something ... different (not sure what ... yet).

All 4 comments

You know you can minify the output?

Yes. Not really the point though when you're design focused and looking at your DOM output. I know the javascript world has destroyed that but one of the nicest things about hugo is outputting simple, classic static html.

Thanks for all the work you do on hugo 馃檹馃徑

You're right, the HTML output from Go templates leave much to be desired ...

Note that I think this should be implemented in the same place as we do output minification. PostProcess is something ... different (not sure what ... yet).

I've written an initial implementation of this: #7825

I'd love some feedback.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

VoidingWarranties picture VoidingWarranties  路  3Comments

artelse picture artelse  路  3Comments

moorereason picture moorereason  路  3Comments

sigma picture sigma  路  3Comments

ianbrandt picture ianbrandt  路  3Comments