README.md (html-minifier-3.6.0) | : | README.md (html-minifier-4.0.0) | ||
---|---|---|---|---|
skipping to change at line 23 | skipping to change at line 23 | |||
Also see corresponding [Ruby wrapper](https://github.com/stereobooster/html_mini fier), and for Node.js, [Grunt plugin](https://github.com/gruntjs/grunt-contrib- htmlmin), [Gulp module](https://github.com/jonschlinkert/gulp-htmlmin), [Koa mid dleware wrapper](https://github.com/koajs/html-minifier) and [Express middleware wrapper](https://github.com/melonmanchan/express-minify-html). | Also see corresponding [Ruby wrapper](https://github.com/stereobooster/html_mini fier), and for Node.js, [Grunt plugin](https://github.com/gruntjs/grunt-contrib- htmlmin), [Gulp module](https://github.com/jonschlinkert/gulp-htmlmin), [Koa mid dleware wrapper](https://github.com/koajs/html-minifier) and [Express middleware wrapper](https://github.com/melonmanchan/express-minify-html). | |||
For lint-like capabilities take a look at [HTMLLint](https://github.com/kangax/h tml-lint). | For lint-like capabilities take a look at [HTMLLint](https://github.com/kangax/h tml-lint). | |||
## Minification comparison | ## Minification comparison | |||
How does HTMLMinifier compare to other solutions — [HTML Minifier from Will Peav y](http://www.willpeavy.com/minifier/) (1st result in [Google search for "html m inifier"](https://www.google.com/#q=html+minifier)) as well as [htmlcompressor.c om](http://htmlcompressor.com) and [minimize](https://github.com/Swaagie/minimiz e)? | How does HTMLMinifier compare to other solutions — [HTML Minifier from Will Peav y](http://www.willpeavy.com/minifier/) (1st result in [Google search for "html m inifier"](https://www.google.com/#q=html+minifier)) as well as [htmlcompressor.c om](http://htmlcompressor.com) and [minimize](https://github.com/Swaagie/minimiz e)? | |||
| Site | Original size *(KB)* | HTMLMinifier | minimize | Will Peavy | htmlcompressor.co m | | | Site | Original size *(KB)* | HTMLMinifier | minimize | Will Peavy | htmlcompressor.co m | | |||
| ---------------------------------------------------------------------------- | :--------------------:| ------------:| --------:| ----------:| ----------------- -:| | | ---------------------------------------------------------------------------- | :--------------------:| ------------:| --------:| ----------:| ----------------- -:| | |||
| [Google](https://www.google.com/) | | | [Google](https://www.google.com/) | | |||
47 | **43** | 47 | 49 | 47 | 46 | **42** | 46 | 48 | 46 | |||
| | | | |||
| [Twitter](https://twitter.com/) | | | [HTMLMinifier](https://github.com/kangax/html-minifier) | | |||
146 | **115** | 138 | 155 | 138 | 125 | **98** | 111 | 117 | 111 | |||
| | | | |||
| [HTMLMinifier](https://github.com/kangax/html-minifier) | | | [Twitter](https://twitter.com/) | | |||
171 | **128** | 143 | 148 | 142 | 207 | **165** | 200 | 224 | 200 | |||
| | | | |||
| [New York Times](https://www.nytimes.com/) | | | [Stack Overflow](https://stackoverflow.com/) | | |||
207 | **139** | 158 | 155 | 144 | 253 | **195** | 207 | 215 | 204 | |||
| | | | |||
| [Stack Overflow](https://stackoverflow.com/) | | | [Bootstrap CSS](https://getbootstrap.com/docs/3.3/css/) | | |||
256 | **199** | 209 | 217 | 206 | 271 | **260** | 269 | 228 | 269 | |||
| | | | |||
| [Bootstrap CSS](https://getbootstrap.com/docs/3.3/css/) | | | [BBC](https://www.bbc.co.uk/) | | |||
271 | **260** | 269 | 229 | 269 | 298 | **239** | 290 | 291 | 280 | |||
| | | | |||
| [BBC](https://www.bbc.co.uk/) | | | [Amazon](https://www.amazon.co.uk/) | | |||
294 | **238** | 285 | 289 | 278 | 422 | **316** | 412 | 425 | n/a | |||
| | | | |||
| [Amazon](https://www.amazon.co.uk/) | | | [NBC](https://www.nbc.com/) | | |||
377 | **328** | 368 | 379 | n/a | 553 | **530** | 552 | 553 | 534 | |||
| | | | |||
| [Wikipedia](https://en.wikipedia.org/wiki/President_of_the_United_States) | | | [Wikipedia](https://en.wikipedia.org/wiki/President_of_the_United_States) | | |||
520 | **484** | 504 | 523 | 503 | 565 | **461** | 548 | 569 | 548 | |||
| | | | |||
| [NBC](https://www.nbc.com/) | | | [New York Times](https://www.nytimes.com/) | | |||
669 | **633** | 668 | 669 | n/a | 678 | **606** | 675 | 670 | n/a | |||
| | | | |||
| [Eloquent Javascript](https://eloquentjavascript.net/1st_edition/print.html) | 870 | **815** | 840 | 864 | n/a | | | [Eloquent Javascript](https://eloquentjavascript.net/1st_edition/print.html) | 870 | **815** | 840 | 864 | n/a | | |||
| [ES6 table](https://kangax.github.io/compat-table/es6/) | | | [ES6 table](https://kangax.github.io/compat-table/es6/) | | |||
5243 | **4472** | 4963 | n/a | n/a | 5911 | **5051** | 5595 | n/a | n/a | |||
| | | | |||
| [ES6 draft](https://tc39.github.io/ecma262/) | | | [ES draft](https://tc39.github.io/ecma262/) | | |||
6072 | **5449** | 5615 | n/a | n/a | 6126 | **5495** | 5664 | n/a | n/a | |||
| | | | |||
## Options Quick Reference | ## Options Quick Reference | |||
Most of the options are disabled by default. | Most of the options are disabled by default. | |||
| Option | Description | Default | | | Option | Description | Default | | |||
|--------------------------------|-----------------|---------| | |--------------------------------|-----------------|---------| | |||
| `caseSensitive` | Treat attributes in case sensitive manner (us eful for custom HTML tags) | `false` | | | `caseSensitive` | Treat attributes in case sensitive manner (us eful for custom HTML tags) | `false` | | |||
| `collapseBooleanAttributes` | [Omit attribute values from boolean attribute s](http://perfectionkills.com/experimenting-with-html-minifier/#collapse_boolean _attributes) | `false` | | | `collapseBooleanAttributes` | [Omit attribute values from boolean attribute s](http://perfectionkills.com/experimenting-with-html-minifier/#collapse_boolean _attributes) | `false` | | |||
| `collapseInlineTagWhitespace` | Don't leave any spaces between `display:inlin e;` elements when collapsing. Must be used in conjunction with `collapseWhitespa ce=true` | `false` | | | `collapseInlineTagWhitespace` | Don't leave any spaces between `display:inlin e;` elements when collapsing. Must be used in conjunction with `collapseWhitespa ce=true` | `false` | | |||
| `collapseWhitespace` | [Collapse white space that contributes to tex t nodes in a document tree](http://perfectionkills.com/experimenting-with-html-m inifier/#collapse_whitespace) | `false` | | | `collapseWhitespace` | [Collapse white space that contributes to tex t nodes in a document tree](http://perfectionkills.com/experimenting-with-html-m inifier/#collapse_whitespace) | `false` | | |||
| `conservativeCollapse` | Always collapse to 1 space (never remove it e ntirely). Must be used in conjunction with `collapseWhitespace=true` | `false` | | | `conservativeCollapse` | Always collapse to 1 space (never remove it e ntirely). Must be used in conjunction with `collapseWhitespace=true` | `false` | | |||
| `continueOnParseError` | [Handle parse errors](https://html.spec.whatw g.org/multipage/parsing.html#parse-errors) instead of aborting. | `false` | | ||||
| `customAttrAssign` | Arrays of regex'es that allow to support cust om attribute assign expressions (e.g. `'<div flex?="{{mode != cover}}"></div>'`) | `[ ]` | | | `customAttrAssign` | Arrays of regex'es that allow to support cust om attribute assign expressions (e.g. `'<div flex?="{{mode != cover}}"></div>'`) | `[ ]` | | |||
| `customAttrCollapse` | Regex that specifies custom attribute to stri p newlines from (e.g. `/ng-class/`) | | | | `customAttrCollapse` | Regex that specifies custom attribute to stri p newlines from (e.g. `/ng-class/`) | | | |||
| `customAttrSurround` | Arrays of regex'es that allow to support cust om attribute surround expressions (e.g. `<input {{#if value}}checked="checked"{{ /if}}>`) | `[ ]` | | | `customAttrSurround` | Arrays of regex'es that allow to support cust om attribute surround expressions (e.g. `<input {{#if value}}checked="checked"{{ /if}}>`) | `[ ]` | | |||
| `customEventAttributes` | Arrays of regex'es that allow to support cust om event attributes for `minifyJS` (e.g. `ng-click`) | `[ /^on[a-z]{3,}$/ ]` | | | `customEventAttributes` | Arrays of regex'es that allow to support cust om event attributes for `minifyJS` (e.g. `ng-click`) | `[ /^on[a-z]{3,}$/ ]` | | |||
| `decodeEntities` | Use direct Unicode characters whenever possib le | `false` | | | `decodeEntities` | Use direct Unicode characters whenever possib le | `false` | | |||
| `html5` | Parse input according to HTML5 specifications | `true` | | | `html5` | Parse input according to HTML5 specifications | `true` | | |||
| `ignoreCustomComments` | Array of regex'es that allow to ignore certai n comments, when matched | `[ /^!/ ]` | | | `ignoreCustomComments` | Array of regex'es that allow to ignore certai n comments, when matched | `[ /^!/ ]` | | |||
| `ignoreCustomFragments` | Array of regex'es that allow to ignore certai n fragments, when matched (e.g. `<?php ... ?>`, `{{ ... }}`, etc.) | `[ /<%[\s\ S]*?%>/, /<\?[\s\S]*?\?>/ ]` | | | `ignoreCustomFragments` | Array of regex'es that allow to ignore certai n fragments, when matched (e.g. `<?php ... ?>`, `{{ ... }}`, etc.) | `[ /<%[\s\ S]*?%>/, /<\?[\s\S]*?\?>/ ]` | | |||
| `includeAutoGeneratedTags` | Insert tags generated by HTML parser | `true` | | | `includeAutoGeneratedTags` | Insert tags generated by HTML parser | `true` | | |||
| `keepClosingSlash` | Keep the trailing slash on singleton elements | `false` | | | `keepClosingSlash` | Keep the trailing slash on singleton elements | `false` | | |||
End of changes. 3 change blocks. | ||||
36 lines changed or deleted | 37 lines changed or added |