Skip to content

markhughes/HTMLMinify-Smarty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

HTMLMinify-Smarty

A simple Smarty filter for minifying HTML.

Hey this works but...

This works, but you may not need this. Most servers these days use gzip, brotli, etc. Although some use cases like obfuscation may apply.

Installation

Copy HTMLMinify.smarty.php into your installation and included it.

Then you can register the filter with smarty:

$smarty->registerFilter("output", "minify_html");

URLs

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);

Inline CSS

By default we minifying inline CSS. You can disable it like this:

define("HTML_MINIFY_INLINE_CSS_ENABLED", false);

Server Side Includes (SSI)

By default we remove all comments, to keep SSI comments you can define this:

define("HTML_MINIFY_KEEP_SSI", true);

About

A simple Smarty filter to minify HTML

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages