danpros / htmly

Simple and fast databaseless PHP blogging platform, and Flat-File CMS
https://www.htmly.com
GNU General Public License v2.0
1.07k stars 261 forks source link

[FEATURE REQUEST] Enable HTML compression #796

Closed sadbird520 closed 1 week ago

sadbird520 commented 2 weeks ago

Thank you to the developer for this fantastic work! Hopefully, developers will add this HTML compression feature. https://github.com/pfaciana/tiny-html-minifier

Joduai commented 2 weeks ago

is minifying outputted html really worth the hassle?

With serverside enabled http compression, and user's browser content-encoding enabled by default, such minifying techniques became a relict of the past, when almost all website's traffic is compressed using gzip,deflate or brotli algorithm. Did you even check if your website's content isn't already compressed?

If only purpose is getting rid of white spaces and new lines in outputted html, you can use a _pregreplace function in your template. There are dozens of snippets about this on stackoverflow. But the real compression gain using such method is unnoticeable.

sadbird520 commented 1 week ago

Thank you for your answer. It seems that there is really no need to force compression of HTML code.