html-minifier
Advanced tools
Comparing version 3.3.1 to 3.3.2
{ | ||
"name": "html-minifier", | ||
"description": "Highly configurable, well-tested, JavaScript-based HTML minifier.", | ||
"version": "3.3.1", | ||
"version": "3.3.2", | ||
"keywords": [ | ||
@@ -69,3 +69,3 @@ "cli", | ||
"grunt-browserify": "5.0.x", | ||
"grunt-contrib-uglify": "2.0.x", | ||
"grunt-contrib-uglify": "2.1.x", | ||
"gruntify-eslint": "3.1.x", | ||
@@ -72,0 +72,0 @@ "phantomjs-prebuilt": "2.1.x", |
@@ -26,14 +26,14 @@ # HTMLMinifier | ||
| [Google](https://www.google.com/) | 44 | **42** | 44 | 46 | 44 | | ||
| [HTMLMinifier](https://github.com/kangax/html-minifier) | 123 | **97** | 105 | 109 | 104 | | ||
| [CNN](http://www.cnn.com/) | 129 | **119** | 126 | 128 | 122 | | ||
| [BBC](http://www.bbc.co.uk/) | 182 | **152** | 176 | 181 | 172 | | ||
| [Amazon](http://www.amazon.co.uk/) | 190 | **158** | 181 | 184 | n/a | | ||
| [Stack Overflow](http://stackoverflow.com/) | 237 | **184** | 194 | 202 | 192 | | ||
| [New York Times](http://www.nytimes.com/) | 243 | **153** | 185 | 181 | 169 | | ||
| [HTMLMinifier](https://github.com/kangax/html-minifier) | 122 | **95** | 103 | 107 | 103 | | ||
| [CNN](http://www.cnn.com/) | 134 | **123** | 132 | 133 | 127 | | ||
| [Amazon](http://www.amazon.co.uk/) | 190 | **158** | 182 | 185 | n/a | | ||
| [New York Times](http://www.nytimes.com/) | 209 | **138** | 157 | 156 | 146 | | ||
| [BBC](http://www.bbc.co.uk/) | 214 | **178** | 207 | 213 | 202 | | ||
| [Stack Overflow](http://stackoverflow.com/) | 240 | **188** | 198 | 206 | 195 | | ||
| [Bootstrap CSS](http://getbootstrap.com/css/) | 272 | **260** | 269 | 229 | 269 | | ||
| [Wikipedia](https://en.wikipedia.org/wiki/President_of_the_United_States) | 543 | **491** | 524 | 542 | 523 | | ||
| [NBC](http://www.nbc.com/) | 566 | **544** | 565 | 567 | 549 | | ||
| [Wikipedia](https://en.wikipedia.org/wiki/President_of_the_United_States) | 546 | **493** | 527 | 545 | 526 | | ||
| [NBC](http://www.nbc.com/) | 566 | **543** | 565 | 566 | 549 | | ||
| [Eloquent Javascript](http://eloquentjavascript.net/1st_edition/print.html) | 870 | **815** | 840 | 864 | n/a | | ||
| [ES6 table](http://kangax.github.io/compat-table/es6/) | 4197 | **3531** | 3959 | n/a | n/a | | ||
| [ES6 draft](https://tc39.github.io/ecma262/) | 5499 | **4904** | 5053 | n/a | n/a | | ||
| [ES6 draft](https://tc39.github.io/ecma262/) | 5507 | **4911** | 5060 | n/a | n/a | | ||
@@ -40,0 +40,0 @@ ## Options Quick Reference |
@@ -24,9 +24,17 @@ 'use strict'; | ||
function compressWhitespace(spaces) { | ||
return spaces === '\t' ? '\t' : ~spaces.indexOf('\xA0') ? '\xA0' : ' '; | ||
return spaces === '\t' ? '\t' : spaces.replace(/(^|\xA0+)[^\xA0]+/g, '$1 '); | ||
} | ||
function collapseWhitespaceAll(str) { | ||
return str ? str.replace(/\s+/g, compressWhitespace) : str; | ||
return str && str.replace(/\s+/g, compressWhitespace); | ||
} | ||
function compressWhitespaceLeft(spaces) { | ||
return spaces === '\t' ? '\t' : spaces.replace(/^[^\xA0]+/, '').replace(/(\xA0+)[^\xA0]+/g, '$1 ') || ' '; | ||
} | ||
function compressWhitespaceRight(spaces) { | ||
return spaces === '\t' ? '\t' : spaces.replace(/[^\xA0]+(\xA0+)/g, ' $1').replace(/[^\xA0]+$/, '') || ' '; | ||
} | ||
function collapseWhitespace(str, options, trimLeft, trimRight, collapseAll) { | ||
@@ -46,7 +54,7 @@ var lineBreakBefore = '', lineBreakAfter = ''; | ||
if (trimLeft) { | ||
str = str.replace(/^\s+/, !lineBreakBefore && options.conservativeCollapse ? compressWhitespace : ''); | ||
str = str.replace(/^\s+/, !lineBreakBefore && options.conservativeCollapse ? compressWhitespaceLeft : ''); | ||
} | ||
if (trimRight) { | ||
str = str.replace(/\s+$/, !lineBreakAfter && options.conservativeCollapse ? compressWhitespace : ''); | ||
str = str.replace(/\s+$/, !lineBreakAfter && options.conservativeCollapse ? compressWhitespaceRight : ''); | ||
} | ||
@@ -53,0 +61,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
88199
2026