Skip to content

Commit e022780

Browse files
author
Christoph Singer
committed
more to read
1 parent fba7bd8 commit e022780

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

+13
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Currently it has the following features:
1414
- Compress embedded Javascript using [mrclay/jsmin-php](https://packagist.org/packages/mrclay/jsmin-php)
1515
- Compress embedded CSS using [tubalmartin/cssmin](https://packagist.org/packages/tubalmartin/cssmin)
1616
- Remove some attributes when their value is empty (by default "style" and "class" attributes)
17+
- Remove comments, except those matching some given regular expressions (by default, IE conditional comments are kept)
1718

1819
Installation
1920
------------
@@ -34,4 +35,16 @@ $output = $pm
3435
// or an \SplFileInfo pointing to an HTML document
3536
->minify()
3637
->saveHtml();
38+
```
39+
40+
Attention: Because the formatting is done directly on the DOM tree, a DOMDocument given to the `load()` method
41+
will be modified:
42+
43+
```php
44+
$dom_document = new \DOMDocument('1.0', 'UTF-8');
45+
$dom_document->loadHTML('<html>...some html code...</html>');
46+
47+
$pm->load($dom_document)->minify();
48+
49+
echo $dom_document->saveHTML(); // Will output the minified, not the original, document
3750
```

0 commit comments

Comments
 (0)