html-minifier
Advanced tools
Comparing version 0.7.1 to 0.7.2
109
cli.js
@@ -7,3 +7,3 @@ #!/usr/bin/env node | ||
* | ||
* Copyright (c) 2014 Zoltan Frombach | ||
* Copyright (c) 2014-2015 Zoltan Frombach | ||
* | ||
@@ -73,3 +73,6 @@ * Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
removeEmptyAttributes: [[false, 'Remove all attributes with whitespace-only values']], | ||
removeScriptTypeAttributes: [[false, 'Remove type="text/javascript" from script tags. Other type attribute values are left intact.']], | ||
removeStyleLinkTypeAttributes: [[false, 'Remove type="text/css" from style and link tags. Other type attribute values are left intact.']], | ||
removeOptionalTags: [[false, 'Remove unrequired tags']], | ||
removeIgnored: [[false, 'Remove all tags starting and ending with <%, %>, <?, ?>']], | ||
removeEmptyElements: [[false, 'Remove all elements with empty contents']], | ||
@@ -84,3 +87,6 @@ lint: [[false, 'Toggle linting']], | ||
processScripts: [[false, 'Array of strings corresponding to types of script elements to process through minifier (e.g. "text/ng-template", "text/x-handlebars-template", etc.)', 'string'], 'json'], | ||
maxLineLength: [[false, 'Max line length', 'number'], true] | ||
maxLineLength: [[false, 'Max line length', 'number'], true], | ||
customAttrAssign: [[false, 'Arrays of regex\'es that allow to support custom attribute assign expressions (e.g. \'<div flex?="{{mode != cover}}"></div>\')', 'string'], 'json'], | ||
customAttrSurround: [[false, 'Arrays of regex\'es that allow to support custom attribute surround expressions (e.g. <input {{#if value}}checked="checked"{{/if}}>)', 'string'], 'json'], | ||
customAttrCollapse: [[false, 'Regex that specifies custom attribute to strip newlines from (e.g. /ng\-class/)', 'string'], true] | ||
}; | ||
@@ -103,2 +109,52 @@ | ||
function parseJSONOption(value) { | ||
if (value !== null) { | ||
var jsonArray; | ||
try { | ||
jsonArray = JSON.parse(value); | ||
} | ||
catch (e) {} | ||
if (jsonArray instanceof Array) { | ||
return jsonArray; | ||
} | ||
else { | ||
return [value]; | ||
} | ||
} | ||
} | ||
function runMinify(original) { | ||
var status = 0; | ||
var minified = null; | ||
try { | ||
minified = minify(original, minifyOptions); | ||
} | ||
catch (e) { | ||
status = 3; | ||
process.stderr.write('Error: Minification error'); | ||
} | ||
if (minifyOptions.lint) { | ||
minifyOptions.lint.populate(); | ||
} | ||
if (minified !== null) { | ||
// Write the output | ||
try { | ||
if (output !== null) { | ||
fs.writeFileSync(path.resolve(output), minified); | ||
} | ||
else { | ||
process.stdout.write(minified); | ||
} | ||
} | ||
catch (e) { | ||
status = 4; | ||
process.stderr.write('Error: Cannot write to output'); | ||
} | ||
} | ||
cli.exit(status); | ||
} | ||
if (options.version) { | ||
@@ -172,51 +228,2 @@ process.stderr.write(appName + ' v' + appVersion); | ||
function parseJSONOption(value) { | ||
if (value !== null) { | ||
var jsonArray; | ||
try { | ||
jsonArray = JSON.parse(value); | ||
} | ||
catch (e) {} | ||
if (jsonArray instanceof Array) { | ||
return jsonArray; | ||
} | ||
else { | ||
return [value]; | ||
} | ||
} | ||
} | ||
function runMinify(original) { | ||
var status = 0; | ||
var minified = null; | ||
try { | ||
minified = minify(original, minifyOptions); | ||
} | ||
catch (e) { | ||
status = 3; | ||
process.stderr.write('Error: Minification error'); | ||
} | ||
if (minifyOptions.lint) { | ||
minifyOptions.lint.populate(); | ||
} | ||
if (minified !== null) { | ||
// Write the output | ||
try { | ||
if (output !== null) { | ||
fs.writeFileSync(path.resolve(output), minified); | ||
} | ||
else { | ||
process.stdout.write(minified); | ||
} | ||
} | ||
catch (e) { | ||
status = 4; | ||
process.stderr.write('Error: Cannot write to output'); | ||
} | ||
} | ||
cli.exit(status); | ||
} | ||
}); |
/*! | ||
* HTMLMinifier v0.7.1 (http://kangax.github.io/html-minifier/) | ||
* HTMLMinifier v0.7.2 (http://kangax.github.io/html-minifier/) | ||
* Copyright 2010-2015 Juriy "kangax" Zaytsev | ||
@@ -4,0 +4,0 @@ * Licensed under MIT (https://github.com/kangax/html-minifier/blob/gh-pages/LICENSE) |
/*! | ||
* HTMLMinifier v0.7.1 (http://kangax.github.io/html-minifier/) | ||
* HTMLMinifier v0.7.2 (http://kangax.github.io/html-minifier/) | ||
* Copyright 2010-2015 Juriy "kangax" Zaytsev | ||
@@ -4,0 +4,0 @@ * Licensed under MIT (https://github.com/kangax/html-minifier/blob/gh-pages/LICENSE) |
{ | ||
"name": "html-minifier", | ||
"description": "HTML minifier with lint-like capabilities.", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "html", |
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
93217
1553