final class HtmlMinifier (View source)

Compacts safe HTML whitespace while preserving raw-text blocks, text blocks, and conditional comments.

Constants

private PRESERVED_TAGS

Tags whose raw text content must be preserved exactly.

private TEXT_BLOCK_TAGS

Tags whose text content can be made single-line with character references.

Methods

string
minify(string|null $html)

Returns compact HTML, or an empty string for null and blank input.

string

Details

minify

string minify(string|null $html)

Returns compact HTML, or an empty string for null and blank input.

Parameters

string|null $html

Return Value

string