Skip to content

Commit

Permalink
Version 3.5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlamsl committed Sep 12, 2017
1 parent 30e0da5 commit e0108f9
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 27 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ How does HTMLMinifier compare to other solutions — [HTML Minifier from Will Pe
| Site | Original size *(KB)* | HTMLMinifier | minimize | Will Peavy | htmlcompressor.com |
| ---------------------------------------------------------------------------- |:--------------------:| ------------:| --------:| ----------:| ------------------:|
| [Google](https://www.google.com/) | 45 | **42** | 45 | 47 | 45 |
| [HTMLMinifier](https://github.com/kangax/html-minifier) | 131 | **102** | 110 | 114 | 109 |
| [Amazon](https://www.amazon.co.uk/) | 204 | **171** | 195 | 199 | n/a |
| [New York Times](https://www.nytimes.com/) | 233 | **159** | 182 | 178 | 166 |
| [Stack Overflow](https://stackoverflow.com/) | 246 | **193** | 202 | 210 | 199 |
| [HTMLMinifier](https://github.com/kangax/html-minifier) | 133 | **104** | 112 | 116 | 111 |
| [Amazon](https://www.amazon.co.uk/) | 203 | **171** | 195 | 199 | n/a |
| [New York Times](https://www.nytimes.com/) | 233 | **158** | 182 | 178 | 166 |
| [Stack Overflow](https://stackoverflow.com/) | 239 | **186** | 195 | 203 | 192 |
| [Bootstrap CSS](https://getbootstrap.com/docs/3.3/css/) | 272 | **260** | 269 | 229 | 269 |
| [Twitter](https://twitter.com/) | 291 | **216** | 257 | 280 | 257 |
| [BBC](https://www.bbc.co.uk/) | 311 | **256** | 302 | 310 | 294 |
| [BBC](https://www.bbc.co.uk/) | 279 | **229** | 271 | 278 | 262 |
| [Twitter](https://twitter.com/) | 298 | **223** | 263 | 287 | 263 |
| [Wikipedia](https://en.wikipedia.org/wiki/President_of_the_United_States) | 469 | **437** | 453 | 468 | 453 |
| [NBC](https://www.nbc.com/) | 663 | **626** | 659 | 663 | n/a |
| [NBC](https://www.nbc.com/) | 665 | **627** | 661 | 664 | 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/) | 4227 | **3585** | 3998 | n/a | n/a |
| [ES6 table](https://kangax.github.io/compat-table/es6/) | 4228 | **3586** | 3999 | n/a | n/a |
| [ES6 draft](https://tc39.github.io/ecma262/) | 5701 | **5087** | 5236 | n/a | n/a |

## Options Quick Reference
Expand Down
28 changes: 13 additions & 15 deletions dist/htmlminifier.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* HTMLMinifier v3.5.4 (http://kangax.github.io/html-minifier/)
* HTMLMinifier v3.5.5 (http://kangax.github.io/html-minifier/)
* Copyright 2010-2017 Juriy "kangax" Zaytsev
* Licensed under the MIT license
*/
Expand Down Expand Up @@ -23698,20 +23698,16 @@ var TokenChain = require('./tokenchain');
var UglifyJS = require('uglify-js');
var utils = require('./utils');

var trimWhitespace = String.prototype.trim ? function(str) {
function trimWhitespace(str) {
if (typeof str !== 'string') {
return str;
}
return str.trim();
} : function(str) {
if (typeof str !== 'string') {
return str;
}
return str.replace(/^\s+/, '').replace(/\s+$/, '');
};
return str.replace(/^[ \n\r\t\f]+/, '').replace(/[ \n\r\t\f]+$/, '');
}

function collapseWhitespaceAll(str) {
return str && str.replace(/\s+/g, function(spaces) {
// Non-breaking space is specifically handled inside the replacer function here:
return str && str.replace(/[ \n\r\t\f\xA0]+/g, function(spaces) {
return spaces === '\t' ? '\t' : spaces.replace(/(^|\xA0+)[^\xA0]+/g, '$1 ');
});
}
Expand All @@ -23720,17 +23716,18 @@ function collapseWhitespace(str, options, trimLeft, trimRight, collapseAll) {
var lineBreakBefore = '', lineBreakAfter = '';

if (options.preserveLineBreaks) {
str = str.replace(/^\s*?[\n\r]\s*/, function() {
str = str.replace(/^[ \n\r\t\f]*?[\n\r][ \n\r\t\f]*/, function() {
lineBreakBefore = '\n';
return '';
}).replace(/\s*?[\n\r]\s*$/, function() {
}).replace(/[ \n\r\t\f]*?[\n\r][ \n\r\t\f]*$/, function() {
lineBreakAfter = '\n';
return '';
});
}

if (trimLeft) {
str = str.replace(/^\s+/, function(spaces) {
// Non-breaking space is specifically handled inside the replacer function here:
str = str.replace(/^[ \n\r\t\f\xA0]+/, function(spaces) {
var conservative = !lineBreakBefore && options.conservativeCollapse;
if (conservative && spaces === '\t') {
return '\t';
Expand All @@ -23740,7 +23737,8 @@ function collapseWhitespace(str, options, trimLeft, trimRight, collapseAll) {
}

if (trimRight) {
str = str.replace(/\s+$/, function(spaces) {
// Non-breaking space is specifically handled inside the replacer function here:
str = str.replace(/[ \n\r\t\f\xA0]+$/, function(spaces) {
var conservative = !lineBreakAfter && options.conservativeCollapse;
if (conservative && spaces === '\t') {
return '\t';
Expand Down Expand Up @@ -24943,7 +24941,7 @@ function minify(value, options, partialMarkup) {
return collapseWhitespace(chunk, {
preserveLineBreaks: options.preserveLineBreaks,
conservativeCollapse: !options.trimCustomFragments
}, /^\s/.test(chunk), /\s$/.test(chunk));
}, /^[ \n\r\t\f]/.test(chunk), /[ \n\r\t\f]$/.test(chunk));
}
return chunk;
});
Expand Down
4 changes: 2 additions & 2 deletions dist/htmlminifier.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<body>
<div id="outer-wrapper">
<div id="wrapper">
<h1>HTML Minifier <span>(v3.5.4)</span></h1>
<h1>HTML Minifier <span>(v3.5.5)</span></h1>
<textarea rows="8" cols="40" id="input"></textarea>
<div class="minify-button">
<button type="button" id="minify-btn">Minify</button>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "html-minifier",
"description": "Highly configurable, well-tested, JavaScript-based HTML minifier.",
"version": "3.5.4",
"version": "3.5.5",
"keywords": [
"cli",
"compress",
Expand Down

0 comments on commit e0108f9

Please sign in to comment.