Skip to content

Commit

Permalink
more to read
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Singer committed Nov 5, 2015
1 parent fba7bd8 commit e022780
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Currently it has the following features:
- Compress embedded Javascript using [mrclay/jsmin-php](https://packagist.org/packages/mrclay/jsmin-php)
- Compress embedded CSS using [tubalmartin/cssmin](https://packagist.org/packages/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
------------
Expand All @@ -34,4 +35,16 @@ $output = $pm
// or an \SplFileInfo pointing to an HTML document
->minify()
->saveHtml();
```

Attention: Because the formatting is done directly on the DOM tree, a DOMDocument given to the `load()` method
will be modified:

```php
$dom_document = new \DOMDocument('1.0', 'UTF-8');
$dom_document->loadHTML('<html>...some html code...</html>');

$pm->load($dom_document)->minify();

echo $dom_document->saveHTML(); // Will output the minified, not the original, document
```

0 comments on commit e022780

Please sign in to comment.