A simple Smarty filter for minifying HTML.
This works, but you may not need this. Most servers these days use gzip, brotli, etc. Although some use cases like obfuscation may apply.
Copy HTMLMinify.smarty.php
into your installation and included it.
Then you can register the filter with smarty:
$smarty->registerFilter("output", "minify_html");
The URL component is also minified. You can change the protocol and URL to
assist with minifying if your $_SERVER
attributes don't match up to the real
URL.
define("HTML_MINIFY_URL", "https://ma.rkhugh.es");
Or if you don't want this feature you can disable it like this:
define("HTML_MINIFY_URL_ENABLED", false);
By default we minifying inline CSS. You can disable it like this:
define("HTML_MINIFY_INLINE_CSS_ENABLED", false);
By default we remove all comments, to keep SSI comments you can define this:
define("HTML_MINIFY_KEEP_SSI", true);