html-minifier
Advanced tools
Comparing version 3.3.2 to 3.3.3
{ | ||
"name": "html-minifier", | ||
"description": "Highly configurable, well-tested, JavaScript-based HTML minifier.", | ||
"version": "3.3.2", | ||
"version": "3.3.3", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "cli", |
@@ -25,15 +25,15 @@ # HTMLMinifier | ||
| --------------------------------------------------------------------------- |:--------------------:| ------------:| --------:| ----------:| ------------------:| | ||
| [Google](https://www.google.com/) | 44 | **42** | 44 | 46 | 44 | | ||
| [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 | | ||
| [Google](https://www.google.com/) | 44 | **42** | 44 | 46 | 45 | | ||
| [HTMLMinifier](https://github.com/kangax/html-minifier) | 122 | **96** | 104 | 108 | 103 | | ||
| [CNN](http://www.cnn.com/) | 134 | **124** | 132 | 133 | 128 | | ||
| [Amazon](http://www.amazon.co.uk/) | 204 | **166** | 195 | 195 | n/a | | ||
| [New York Times](http://www.nytimes.com/) | 208 | **137** | 157 | 155 | 146 | | ||
| [BBC](http://www.bbc.co.uk/) | 214 | **178** | 207 | 213 | 202 | | ||
| [Stack Overflow](http://stackoverflow.com/) | 240 | **188** | 198 | 206 | 195 | | ||
| [Stack Overflow](http://stackoverflow.com/) | 240 | **188** | 198 | 206 | 196 | | ||
| [Bootstrap CSS](http://getbootstrap.com/css/) | 272 | **260** | 269 | 229 | 269 | | ||
| [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 | | ||
| [Wikipedia](https://en.wikipedia.org/wiki/President_of_the_United_States) | 546 | **499** | 527 | 545 | 526 | | ||
| [NBC](http://www.nbc.com/) | 566 | **544** | 565 | 567 | 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/) | 5507 | **4911** | 5060 | n/a | n/a | | ||
| [ES6 draft](https://tc39.github.io/ecma262/) | 5507 | **4914** | 5060 | n/a | n/a | | ||
@@ -40,0 +40,0 @@ ## Options Quick Reference |
@@ -23,18 +23,8 @@ 'use strict'; | ||
function compressWhitespace(spaces) { | ||
return spaces === '\t' ? '\t' : spaces.replace(/(^|\xA0+)[^\xA0]+/g, '$1 '); | ||
} | ||
function collapseWhitespaceAll(str) { | ||
return str && str.replace(/\s+/g, compressWhitespace); | ||
return str && str.replace(/\s+/g, function(spaces) { | ||
return spaces === '\t' ? '\t' : spaces.replace(/(^|\xA0+)[^\xA0]+/g, '$1 '); | ||
}); | ||
} | ||
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) { | ||
@@ -54,7 +44,19 @@ var lineBreakBefore = '', lineBreakAfter = ''; | ||
if (trimLeft) { | ||
str = str.replace(/^\s+/, !lineBreakBefore && options.conservativeCollapse ? compressWhitespaceLeft : ''); | ||
str = str.replace(/^\s+/, function(spaces) { | ||
var conservative = !lineBreakBefore && options.conservativeCollapse; | ||
if (conservative && spaces === '\t') { | ||
return '\t'; | ||
} | ||
return spaces.replace(/^[^\xA0]+/, '').replace(/(\xA0+)[^\xA0]+/g, '$1 ') || (conservative ? ' ' : ''); | ||
}); | ||
} | ||
if (trimRight) { | ||
str = str.replace(/\s+$/, !lineBreakAfter && options.conservativeCollapse ? compressWhitespaceRight : ''); | ||
str = str.replace(/\s+$/, function(spaces) { | ||
var conservative = !lineBreakAfter && options.conservativeCollapse; | ||
if (conservative && spaces === '\t') { | ||
return '\t'; | ||
} | ||
return spaces.replace(/[^\xA0]+(\xA0+)/g, ' $1').replace(/[^\xA0]+$/, '') || (conservative ? ' ' : ''); | ||
}); | ||
} | ||
@@ -61,0 +63,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
88264
2031