html-minifier
Advanced tools
Comparing version 3.1.1 to 3.2.2
@@ -30,6 +30,7 @@ #!/usr/bin/env node | ||
var changeCase = require('change-case'); | ||
var camelCase = require('camel-case'); | ||
var fs = require('fs'); | ||
var info = require('./package.json'); | ||
var minify = require('./' + info.main).minify; | ||
var paramCase = require('param-case'); | ||
var path = require('path'); | ||
@@ -142,3 +143,3 @@ var program = require('commander'); | ||
var option = mainOptions[key]; | ||
key = '--' + changeCase.paramCase(key); | ||
key = '--' + paramCase(key); | ||
if (Array.isArray(option)) { | ||
@@ -202,3 +203,3 @@ var optional = option[1] === parseJSON; | ||
mainOptionKeys.forEach(function(key) { | ||
var param = program[changeCase.camelCase(key)]; | ||
var param = program[camelCase(key)]; | ||
if (typeof param !== 'undefined') { | ||
@@ -205,0 +206,0 @@ options[key] = param; |
{ | ||
"name": "html-minifier", | ||
"description": "Highly configurable, well-tested, JavaScript-based HTML minifier.", | ||
"version": "3.1.1", | ||
"version": "3.2.2", | ||
"keywords": [ | ||
@@ -57,3 +57,3 @@ "cli", | ||
"dependencies": { | ||
"change-case": "3.0.x", | ||
"camel-case": "3.0.x", | ||
"clean-css": "3.4.x", | ||
@@ -63,2 +63,3 @@ "commander": "2.9.x", | ||
"ncname": "1.0.x", | ||
"param-case": "2.1.x", | ||
"relateurl": "0.2.x", | ||
@@ -65,0 +66,0 @@ "uglify-js": "2.7.x" |
@@ -25,15 +25,15 @@ # HTMLMinifier | ||
| --------------------------------------------------------------------------- |:--------------------:| ------------:| --------:| ----------:| ------------------:| | ||
| [Google](https://www.google.com/) | 44 | **42** | 44 | 45 | 44 | | ||
| [HTMLMinifier](https://github.com/kangax/html-minifier) | 120 | **81** | 102 | 106 | 102 | | ||
| [CNN](http://www.cnn.com/) | 133 | **121** | 129 | 130 | 125 | | ||
| [Amazon](http://www.amazon.co.uk/) | 171 | **139** | 163 | 166 | n/a | | ||
| [BBC](http://www.bbc.co.uk/) | 178 | **145** | 171 | 174 | 166 | | ||
| [New York Times](http://www.nytimes.com/) | 195 | **129** | 144 | 146 | 138 | | ||
| [Stack Overflow](http://stackoverflow.com/) | 242 | **186** | 196 | 204 | 193 | | ||
| [Google](https://www.google.com/) | 44 | **43** | 44 | 46 | 45 | | ||
| [HTMLMinifier](https://github.com/kangax/html-minifier) | 122 | **96** | 104 | 108 | 103 | | ||
| [CNN](http://www.cnn.com/) | 129 | **118** | 126 | 127 | 122 | | ||
| [Amazon](http://www.amazon.co.uk/) | 170 | **138** | 162 | 165 | n/a | | ||
| [BBC](http://www.bbc.co.uk/) | 185 | **151** | 178 | 183 | 174 | | ||
| [New York Times](http://www.nytimes.com/) | 187 | **124** | 137 | 139 | 132 | | ||
| [Stack Overflow](http://stackoverflow.com/) | 245 | **189** | 198 | 207 | 196 | | ||
| [Bootstrap CSS](http://getbootstrap.com/css/) | 276 | **264** | 273 | 231 | 274 | | ||
| [Wikipedia](https://en.wikipedia.org/wiki/President_of_the_United_States) | 493 | **449** | 477 | 491 | n/a | | ||
| [NBC](http://www.nbc.com/) | 551 | **529** | 549 | 551 | n/a | | ||
| [Eloquent Javascript](http://eloquentjavascript.net/1st_edition/print.html) | 870 | **815** | 840 | n/a | n/a | | ||
| [ES6 table](http://kangax.github.io/compat-table/es6/) | 4204 | **3541** | 3966 | n/a | n/a | | ||
| [ES6 draft](https://tc39.github.io/ecma262/) | 4873 | **4329** | 4459 | n/a | n/a | | ||
| [Wikipedia](https://en.wikipedia.org/wiki/President_of_the_United_States) | 501 | **456** | 484 | 499 | n/a | | ||
| [NBC](http://www.nbc.com/) | 550 | **528** | 548 | 550 | n/a | | ||
| [Eloquent Javascript](http://eloquentjavascript.net/1st_edition/print.html) | 870 | **815** | 840 | 864 | n/a | | ||
| [ES6 table](http://kangax.github.io/compat-table/es6/) | 4010 | **3374** | 3781 | n/a | n/a | | ||
| [ES6 draft](https://tc39.github.io/ecma262/) | 5156 | **4594** | 4726 | n/a | n/a | | ||
@@ -70,3 +70,3 @@ ## Options Quick Reference | ||
| `removeComments` | [Strip HTML comments](http://perfectionkills.com/experimenting-with-html-minifier/#remove_comments) | `false` | | ||
| `removeEmptyAttributes` | [Remove all attributes with whitespace-only values](http://perfectionkills.com/experimenting-with-html-minifier/#remove_empty_or_blank_attributes) | `false` | | ||
| `removeEmptyAttributes` | [Remove all attributes with whitespace-only values](http://perfectionkills.com/experimenting-with-html-minifier/#remove_empty_or_blank_attributes) | `false` (could be true, Function(attrName, tag)) | | ||
| `removeEmptyElements` | [Remove all elements with empty contents](http://perfectionkills.com/experimenting-with-html-minifier/#remove_empty_elements) | `false` | | ||
@@ -73,0 +73,0 @@ | `removeOptionalTags` | [Remove optional tags](http://perfectionkills.com/experimenting-with-html-minifier/#remove_optional_tags) | `false` | |
@@ -458,8 +458,11 @@ 'use strict'; | ||
function canDeleteEmptyAttribute(tag, attrName, attrValue) { | ||
function canDeleteEmptyAttribute(tag, attrName, attrValue, options) { | ||
var isValueEmpty = !attrValue || /^\s*$/.test(attrValue); | ||
if (isValueEmpty) { | ||
return tag === 'input' && attrName === 'value' || reEmptyAttribute.test(attrName); | ||
if (!isValueEmpty) { | ||
return false; | ||
} | ||
return false; | ||
if (typeof options.removeEmptyAttributes === 'function') { | ||
return options.removeEmptyAttributes(attrName, tag); | ||
} | ||
return tag === 'input' && attrName === 'value' || reEmptyAttribute.test(attrName); | ||
} | ||
@@ -534,3 +537,3 @@ | ||
if (options.removeEmptyAttributes && | ||
canDeleteEmptyAttribute(tag, attrName, attrValue)) { | ||
canDeleteEmptyAttribute(tag, attrName, attrValue, options)) { | ||
return; | ||
@@ -537,0 +540,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
88043
2025
8
+ Addedcamel-case@3.0.x
+ Addedparam-case@2.1.x
- Removedchange-case@3.0.x
- Removedchange-case@3.0.2(transitive)
- Removedconstant-case@2.0.0(transitive)
- Removeddot-case@2.1.1(transitive)
- Removedheader-case@1.0.1(transitive)
- Removedis-lower-case@1.1.3(transitive)
- Removedis-upper-case@1.1.2(transitive)
- Removedlower-case-first@1.0.2(transitive)
- Removedpascal-case@2.0.1(transitive)
- Removedpath-case@2.1.1(transitive)
- Removedsentence-case@2.1.1(transitive)
- Removedsnake-case@2.1.0(transitive)
- Removedswap-case@1.1.2(transitive)
- Removedtitle-case@2.1.1(transitive)
- Removedupper-case-first@1.1.2(transitive)