HTML Minifier

HTML Minifier:

When you minify your website's CSS, HTML, and Javascript files, you can save crucial time on page load time. We're not talking about having your page load speed or anything, but when it comes to website speed, every little bit helps. The speed with which your site loads is vital not just for first-time visitors, but also for moving search engine rankings.

The phrase "minify" refers to the process of deleting unneeded characters from source code in programming. Whitespaces, line breaks, comments, and block delimiters are examples of characters that are valuable to humans but unneeded to machines. We minify a website's CSS, HTML, and Javascript code files so that your web browser can read them faster.

Sorting attributes/style classes:

SortAttributes and sortClassName minifier settings have no effect on the plain-text size of the result. They do, however, form long repetitive chains of characters, which should improve the compression ratio of gzip, which is used in HTTP compression.

Special cases:

Ignoring chunks of markup

If you have chunks of markup you would like preserved, you can wrap them <!-- htmlmin:ignore -->.

Preserving SVG tags

SVG tags are automatically recognized, and when they are minified, both case sensitivity and closing-slashes are preserved, regardless of the minification settings used for the rest of the file.

Working with invalid markup

HTMLMinifier cannot work with faulty or incomplete markup. This is due to the fact that it parses markup into a tree structure, modifies it (removing anything that was indicated for removal, ignoring anything that was intended to be ignored, and so on), and then produces and returns markup from that tree.

Input markup (e.g. <p id="">foo)

The internal representation of markup in a form of a tree (e.g. { tag: "p", attr: "id", children: ["foo"] })

Transformation of internal representation (e.g. removal of id attribute)

The output of the resulting markup (e.g. <p>foo</p>)

HTMLMinifier has no way of knowing that the initial markup was only half of the tree; it tries to parse it as a whole tree and loses information about the tree being faulty or partial in the beginning. As a result, it cannot generate a partial/malformed tree during the output.

 

 

 

Cookie
We care about your data and would love to use cookies to improve your experience.