module

Plombir::Utils::Html

Constants

COMMENT = /<!--(?!\[if).*?-->/m

HTML comments, except conditional <!--[if …]> ones.

PROTECTED = /<(pre|textarea|script|style)\b.*?<\/\1>/im

Blocks rendering verbatim — never touched by minify.

Class methods

minify(html : String) : String

Collapses rendering-neutral whitespace: comments, trailing spaces, and blank lines. Inter-tag spacing is deliberately preserved — </span> <span> renders its space, so removing it would change pages (see docs/seo.md).

Plombir::Utils::Html.minify("<p>Hi.</p>\n\n<!-- note -->\n") # => "<p>Hi.</p>\n"
Source