Download the PHP package wa72/html-pretty-min without Composer
On this page you can find all versions of the php package wa72/html-pretty-min. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download wa72/html-pretty-min
More information about wa72/html-pretty-min
Files in wa72/html-pretty-min
Package html-pretty-min
Short Description HTML minifier and indenter that works on the DOM tree
License MIT
Informations about the package html-pretty-min
HTML Pretty-Min
HTML Pretty-Min is a PHP library for minifying and prettyprinting (indenting) HTML documents that works directly on the DOM tree of an HTML document.
Currently, it has the following features:
-
Prettyprint:
- Indent Block-level elements, do not indent inline elements
- Minify:
- Remove whitespace and newlines
- Compress embedded Javascript using mrclay/jsmin-php
- Compress embedded CSS using tubalmartin/cssmin
- Remove some attributes when their value is empty (by default "style" and "class" attributes)
- Remove comments, except those matching some given regular expressions (by default, IE conditional comments are kept)
Installation
HTML Pretty-Min is listed on Packagist.
composer require wa72/html-pretty-min
Usage
For prettyprinting, call the indent() method instead of minify().
The PrettyMin() constructor can be given an associative options array. Here are the possible option keys and their default values:
Attention: Because the formatting is done directly on the DOM tree, a DOMDocument object given to the load() method
will be modified:
All versions of html-pretty-min with dependencies
mrclay/jsmin-php Version ^2.3
tubalmartin/cssmin Version ^4
symfony/options-resolver Version >=2.3