File tree 1 file changed +13
-0
lines changed
1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ Currently it has the following features:
14
14
- Compress embedded Javascript using [ mrclay/jsmin-php] ( https://packagist.org/packages/mrclay/jsmin-php )
15
15
- Compress embedded CSS using [ tubalmartin/cssmin] ( https://packagist.org/packages/tubalmartin/cssmin )
16
16
- 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)
17
18
18
19
Installation
19
20
------------
@@ -34,4 +35,16 @@ $output = $pm
34
35
// or an \SplFileInfo pointing to an HTML document
35
36
->minify()
36
37
->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
37
50
```
You can’t perform that action at this time.
0 commit comments