Skip to content

Commit

Permalink
Version 3.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlamsl committed Feb 19, 2017
1 parent f2ad7a6 commit 7b3a59a
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 24 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ 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/) | 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 |

## Options Quick Reference

Expand Down
24 changes: 16 additions & 8 deletions dist/htmlminifier.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* HTMLMinifier v3.3.1 (http://kangax.github.io/html-minifier/)
* HTMLMinifier v3.3.2 (http://kangax.github.io/html-minifier/)
* Copyright 2010-2017 Juriy "kangax" Zaytsev
* Licensed under the MIT license
*/
Expand Down Expand Up @@ -2668,7 +2668,7 @@ function optimizeZeroUnits(name, value) {
}

function removeQuotes(name, value) {
if (name == 'content') {
if (name == 'content' || name.indexOf('font-feature-settings') > -1) {
return value;
}

Expand Down Expand Up @@ -5058,8 +5058,6 @@ function extractPseudoFrom(selector) {

if (isEscaped) {
buffer.push(character);
} else if (isQuoted) {
buffer.push(character);
} else if (character == Marker.DOUBLE_QUOTE && level == Level.ROOT) {
buffer.push(character);
level = Level.DOUBLE_QUOTE;
Expand All @@ -5072,6 +5070,8 @@ function extractPseudoFrom(selector) {
} else if (character == Marker.SINGLE_QUOTE && level == Level.SINGLE_QUOTE) {
buffer.push(character);
level = Level.ROOT;
} else if (isQuoted) {
buffer.push(character);
} else if (character == Marker.OPEN_ROUND_BRACKET) {
buffer.push(character);
roundBracketLevel++;
Expand Down Expand Up @@ -32198,11 +32198,19 @@ var trimWhitespace = String.prototype.trim ? function(str) {
};

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) {
Expand All @@ -32219,11 +32227,11 @@ function collapseWhitespace(str, options, trimLeft, trimRight, collapseAll) {
}

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 : '');
}

if (collapseAll) {
Expand Down
8 changes: 4 additions & 4 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.3.1)</span></h1>
<h1>HTML Minifier <span>(v3.3.2)</span></h1>
<textarea rows="8" cols="40" id="input"></textarea>
<div class="minify-button">
<button type="button" id="minify-btn">Minify</button>
Expand Down
4 changes: 2 additions & 2 deletions 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.3.1",
"version": "3.3.2",
"keywords": [
"cli",
"compress",
Expand Down Expand Up @@ -66,7 +66,7 @@
"devDependencies": {
"grunt": "1.0.x",
"grunt-browserify": "5.0.x",
"grunt-contrib-uglify": "2.0.x",
"grunt-contrib-uglify": "2.1.x",
"gruntify-eslint": "3.1.x",
"phantomjs-prebuilt": "2.1.x",
"qunitjs": "2.x"
Expand Down

0 comments on commit 7b3a59a

Please sign in to comment.