html-minifier
Advanced tools
Comparing version 2.1.1 to 2.1.2
@@ -33,3 +33,3 @@ #!/usr/bin/env node | ||
var info = require('./package.json'); | ||
var minify = require('.').minify; | ||
var minify = require('./' + info.main).minify; | ||
var path = require('path'); | ||
@@ -36,0 +36,0 @@ var program = require('commander'); |
{ | ||
"name": "html-minifier", | ||
"description": "Highly configurable, well-tested, JavaScript-based HTML minifier.", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "cli", |
@@ -26,9 +26,9 @@ # HTMLMinifier | ||
| [Google](https://www.google.com/) | 57 | **54** | 57 | 59 | 57 | | ||
| [CNN](http://www.cnn.com/) | 105 | **95** | 101 | 103 | 99 | | ||
| [HTMLMinifier](https://github.com/kangax/html-minifier) | 117 | **75** | 99 | 104 | 100 | | ||
| [BBC](http://www.bbc.co.uk/) | 151 | **121** | 146 | 150 | 144 | | ||
| [New York Times](http://www.nytimes.com/) | 175 | **110** | 125 | 129 | 125 | | ||
| [Stack Overflow](http://stackoverflow.com/) | 242 | **187** | 197 | 206 | 195 | | ||
| [CNN](http://www.cnn.com/) | 108 | **98** | 105 | 106 | 103 | | ||
| [HTMLMinifier](https://github.com/kangax/html-minifier) | 117 | **76** | 100 | 104 | 100 | | ||
| [BBC](http://www.bbc.co.uk/) | 151 | **121** | 145 | 150 | 144 | | ||
| [New York Times](http://www.nytimes.com/) | 171 | **107** | 122 | 126 | 122 | | ||
| [Stack Overflow](http://stackoverflow.com/) | 239 | **184** | 193 | 202 | 192 | | ||
| [Bootstrap CSS](http://getbootstrap.com/css/) | 277 | **264** | 274 | 232 | 274 | | ||
| [Amazon](http://www.amazon.co.uk/) | 410 | **356** | 391 | 403 | n/a | | ||
| [Amazon](http://www.amazon.co.uk/) | 456 | **400** | 437 | 450 | n/a | | ||
| [NBC](http://www.nbc.com/) | 465 | **446** | 464 | 465 | n/a | | ||
@@ -35,0 +35,0 @@ | [Wikipedia](https://en.wikipedia.org/wiki/President_of_the_United_States) | 475 | **422** | 459 | 474 | n/a | |
@@ -38,3 +38,3 @@ 'use strict'; | ||
return ''; | ||
}).replace(/[\t\n\r ]*[\n\r][\t ]*$/, function() { | ||
}).replace(/[\t ]*[\n\r][\t\n\r ]*$/, function() { | ||
lineBreakAfter = '\n'; | ||
@@ -808,3 +808,5 @@ return ''; | ||
processOptions(options); | ||
value = options.collapseWhitespace ? trimWhitespace(value) : value; | ||
if (options.collapseWhitespace) { | ||
value = collapseWhitespace(value, options, true, true); | ||
} | ||
@@ -1090,3 +1092,3 @@ var buffer = [], | ||
} | ||
if (buffer.length > 1 && (!prevComment || / $/.test(currentChars))) { | ||
if (buffer.length > 1 && (!prevComment || !options.conservativeCollapse && / $/.test(currentChars))) { | ||
var charsIndex = buffer.length - 2; | ||
@@ -1110,3 +1112,8 @@ buffer[charsIndex] = buffer[charsIndex].replace(/\s+$/, function(trailingSpaces) { | ||
} | ||
text = prevTag || nextTag ? collapseWhitespaceSmart(text, prevTag, nextTag, options) : trimWhitespace(text); | ||
if (prevTag || nextTag) { | ||
text = collapseWhitespaceSmart(text, prevTag, nextTag, options); | ||
} | ||
else { | ||
text = collapseWhitespace(text, options, true, true); | ||
} | ||
if (!text && /\s$/.test(currentChars) && prevTag && prevTag.charAt(0) === '/') { | ||
@@ -1116,4 +1123,4 @@ trimTrailingWhitespace(buffer.length - 1, nextTag); | ||
} | ||
if (!stackNoCollapseWhitespace.length) { | ||
text = prevTag && nextTag || nextTag === 'html' ? text : collapseWhitespaceAll(text); | ||
if (!stackNoCollapseWhitespace.length && nextTag !== 'html' && !(prevTag && nextTag)) { | ||
text = collapseWhitespace(text, options, false, false, true); | ||
} | ||
@@ -1256,4 +1263,3 @@ } | ||
} | ||
return options.collapseWhitespace ? trimWhitespace(str) : str; | ||
return options.collapseWhitespace ? collapseWhitespace(str, options, true, true) : str; | ||
} | ||
@@ -1260,0 +1266,0 @@ |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
85270
1955
3