Socket
Socket
Sign inDemoInstall

html-minifier

Package Overview
Dependencies
Maintainers
2
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-minifier - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

17

cli.js

@@ -31,3 +31,2 @@ #!/usr/bin/env node

var changeCase = require('change-case');
var concat = require('concat-stream');
var fs = require('fs');

@@ -39,3 +38,4 @@ var info = require('./package.json');

program.version(info.version).description(info.name + ' command-line tool');
program._name = info.name;
program.version(info.version);

@@ -250,7 +250,6 @@ function fatal(message) {

function writeMinify(content) {
function writeMinify() {
var minified;
try {
var options = createOptions();
minified = minify(content, options);
minified = minify(content, createOptions());
}

@@ -276,7 +275,11 @@ catch (e) {

else if (typeof content === 'string') {
writeMinify(content);
writeMinify();
}
// Minifying input coming from STDIN
else {
process.stdin.pipe(concat({ encoding: 'string' }, writeMinify));
content = '';
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(data) {
content += data;
}).on('end', writeMinify);
}
{
"name": "html-minifier",
"description": "Highly configurable, well-tested, JavaScript-based HTML minifier.",
"version": "2.1.0",
"version": "2.1.1",
"keywords": [

@@ -29,2 +29,3 @@ "cli",

"maintainers": [
"Alex Lam <alexlamsl@gmail.com>",
"Juriy Zaytsev <kangax@gmail.com> (http://perfectionkills.com)"

@@ -60,3 +61,2 @@ ],

"commander": "2.9.x",
"concat-stream": "1.5.x",
"he": "1.0.x",

@@ -63,0 +63,0 @@ "ncname": "1.0.x",

@@ -25,15 +25,15 @@ # HTMLMinifier

| --------------------------------------------------------------------------- |:--------------------:| ------------:| --------:| ----------:| ------------------:|
| [Google](https://www.google.com/) | 53 | **50** | 53 | 55 | 53 |
| [CNN](http://www.cnn.com/) | 107 | **97** | 104 | 105 | 102 |
| [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/) | 132 | **104** | 127 | 131 | 125 |
| [New York Times](http://www.nytimes.com/) | 169 | **106** | 120 | 124 | 120 |
| [Amazon](http://www.amazon.com/) | 215 | **181** | 207 | 209 | n/a |
| [Stack Overflow](http://stackoverflow.com/) | 242 | **187** | 196 | 205 | 195 |
| [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 |
| [Bootstrap CSS](http://getbootstrap.com/css/) | 277 | **264** | 274 | 232 | 274 |
| [NBC](http://www.nbc.com/) | 465 | **445** | 463 | 465 | n/a |
| [Amazon](http://www.amazon.co.uk/) | 410 | **356** | 391 | 403 | n/a |
| [NBC](http://www.nbc.com/) | 465 | **446** | 464 | 465 | n/a |
| [Wikipedia](https://en.wikipedia.org/wiki/President_of_the_United_States) | 475 | **422** | 459 | 474 | 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/) | 3659 | **3077** | 3447 | 3616 | n/a |
| [ES6 draft](https://tc39.github.io/ecma262/) | 4775 | **4223** | 4353 | 4474 | n/a |
| [ES6 table](http://kangax.github.io/compat-table/es6/) | 3780 | **3177** | 3559 | 3736 | n/a |
| [ES6 draft](https://tc39.github.io/ecma262/) | 4774 | **4222** | 4352 | 4474 | n/a |

@@ -40,0 +40,0 @@ ## Options Quick Reference

'use strict';
function Sorter(tokens) {
this.tokens = tokens;
function Sorter() {
}

@@ -33,3 +32,7 @@

tokens.forEach(function(token) {
(self[token] || (self[token] = [])).push(tokens);
if (!self[token]) {
self[token] = [];
self[token].processed = 0;
}
self[token].push(tokens);
});

@@ -39,17 +42,24 @@ },

var self = this;
var sorter = new Sorter(Object.keys(this).sort(function(j, k) {
var sorter = new Sorter();
sorter.tokens = Object.keys(this).sort(function(j, k) {
var m = self[j].length;
var n = self[k].length;
return m < n ? 1 : m > n ? -1 : j < k ? -1 : j > k ? 1 : 0;
}));
sorter.tokens.forEach(function(token) {
var chain = new TokenChain();
self[token].forEach(function(tokens) {
var index;
while ((index = tokens.indexOf(token)) !== -1) {
tokens.splice(index, 1);
}
chain.add(tokens.slice(0));
});
sorter[token] = chain.createSorter();
}).filter(function(token) {
if (self[token].processed < self[token].length) {
var chain = new TokenChain();
self[token].forEach(function(tokens) {
var index;
while ((index = tokens.indexOf(token)) !== -1) {
tokens.splice(index, 1);
}
tokens.forEach(function(token) {
self[token].processed++;
});
chain.add(tokens.slice(0));
});
sorter[token] = chain.createSorter();
return true;
}
return false;
});

@@ -56,0 +66,0 @@ return sorter;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc