Hi all – The new pipeline stack appears to be using this minifier: https://github.com/tdewolff/minify
This minifier will delete your html, head, and body tags by default.
It will also delete a lot of other tags, as well as conditional comments (IE-related).
The developer of this minifier is somewhat confused. He reads one of the HTML specs (there are two), and when he sees that an element/tag is specified as “optional”, he thinks this means that a minifier should delete it by default. He places his idiosyncratic spec-reading above conformance with the web as it is in reality, and takes huge risks with other people’s HTML, CSS, etc. And if something isn’t in the spec, like conditional comments, he thinks he should just delete it… (Conditional comments are becoming less and less relevant, but if they’re in someone’s code, they put them there for a reason, perhaps knowing their user base is some enterprise or state government that still has older versions of IE or something. There are a million different contexts out there, and if conditional comments are deliberately placed in the HTML source, they’re there for a reason and should be left alone by default.)
He also doesn’t understand that browsers are not the only consumers of HTML or of websites. I’ve tried to explain this to him. The spec is really only about browser rendering. The head tags encapsulate a lot of metadata for FB, Twitter, Schema.org, Google’s bot, AMP’s CSS, etc and some of those services won’t parse your metadata if it’s not wrapped in head tags. It’s just incredibly reckless to delete your html, head, and body tags and expect your website to work normally, or for SEO and social media metadata to work. It doesn’t matter that an HTML spec calls those tags “optional”. The spec is written for browsers and what they should render – it doesn’t anticipate the metadata situation we have on the modern web, and “optional” doesn’t mean “delete it when you see it”.
There were comments on the Caddy discourse that talked about the minifier breaking sites, some of which might have been censored or deleted. This is a bad minifier, and it seems to keep popping up in Go projects simply because it happens to be written in Go. We need a new minifier if we want safety and rigor.