Skip to content

Commit

Permalink
remove lint functionalities
Browse files Browse the repository at this point in the history
link to HTMLLint project in README.md
fixes #80
  • Loading branch information
alexlamsl committed Apr 16, 2016
1 parent 4bc5f5f commit 22d1340
Show file tree
Hide file tree
Showing 15 changed files with 6,830 additions and 7,346 deletions.
6 changes: 0 additions & 6 deletions Gruntfile.js
Expand Up @@ -31,7 +31,6 @@ module.exports = function(grunt) {
options: {
banner: '<%= banner %>',
require: [
'./src/htmllint.js:html-minifier/src/htmllint',
'./src/htmlminifier.js:html-minifier'
]
},
Expand Down Expand Up @@ -59,7 +58,6 @@ module.exports = function(grunt) {
},

qunit: {
htmllint: ['./tests/lint', 'tests/lint-tests.html'],
htmlminifier: ['./tests/minifier', 'tests/index.html']
},

Expand All @@ -71,10 +69,6 @@ module.exports = function(grunt) {
'./tests/index.html': [
/("[^"]+\/qunit-)[0-9\.]+?(\.(?:css|js)")/g,
'$1<%= qunit_ver %>$2'
],
'./tests/lint-tests.html': [
/("[^"]+\/qunit-)[0-9\.]+?(\.(?:css|js)")/g,
'$1<%= qunit_ver %>$2'
]
},

Expand Down
5 changes: 3 additions & 2 deletions README.md
Expand Up @@ -7,14 +7,16 @@
[![optionalDependency Status](https://img.shields.io/david/optional/kangax/html-minifier.svg)](https://david-dm.org/kangax/html-minifier#info=optionalDependencies)
[![Gitter](https://img.shields.io/gitter/room/kangax/html-minifier.svg)](https://gitter.im/kangax/html-minifier)

[HTMLMinifier](http://kangax.github.io/html-minifier/) is a highly **configurable**, **well-tested**, JavaScript-based HTML minifier, with lint-like capabilities.
[HTMLMinifier](http://kangax.github.io/html-minifier/) is a highly **configurable**, **well-tested**, JavaScript-based HTML minifier.

See [corresponding blog post](http://perfectionkills.com/experimenting-with-html-minifier/) for all the gory details of [how it works](http://perfectionkills.com/experimenting-with-html-minifier/#how_it_works), [description of each option](http://perfectionkills.com/experimenting-with-html-minifier/#options), [testing results](http://perfectionkills.com/experimenting-with-html-minifier/#field_testing) and [conclusions](http://perfectionkills.com/experimenting-with-html-minifier/#cost_and_benefits).

[Test suite is available online](http://kangax.github.io/html-minifier/tests/).

Also see corresponding [Ruby wrapper](https://github.com/stereobooster/html_minifier), and for Node.js, [Grunt plugin](https://github.com/gruntjs/grunt-contrib-htmlmin), [Gulp module](https://github.com/jonschlinkert/gulp-htmlmin), and [Koa middleware wrapper](https://github.com/koajs/html-minifier).

For lint-like capabilities take a look at [HTMLLint](https://github.com/kangax/html-lint).

## Minification comparison

How does HTMLMinifier compare to other solutions — [HTML Minifier from Will Peavy](http://www.willpeavy.com/minifier/) (1st result in [Google search for "html minifier"](https://www.google.com/#q=html+minifier)) as well as [htmlcompressor.com](http://htmlcompressor.com) and [minimize](https://github.com/Swaagie/minimize)?
Expand Down Expand Up @@ -54,7 +56,6 @@ How does HTMLMinifier compare to other solutions — [HTML Minifier from Will Pe
| `ignoreCustomFragments` | Array of regex'es that allow to ignore certain fragments, when matched (e.g. `<?php ... ?>`, `{{ ... }}`, etc.) | `[ /<%[\s\S]*?%>/, /<\?[\s\S]*?\?>/ ]` |
| `includeAutoGeneratedTags` | Insert tags generated by HTML parser | `true` |
| `keepClosingSlash` | Keep the trailing slash on singleton elements | `false` |
| `lint` | [Toggle linting](http://perfectionkills.com/experimenting-with-html-minifier/#validate_input_through_html_lint) | `false` |
| `maxLineLength` | Specify a maximum line length. Compressed output will be split by newlines at valid HTML split-points |
| `minifyCSS` | Minify CSS in style elements and style attributes (uses [clean-css](https://github.com/jakubpawlowicz/clean-css)) | `false` (could be `true`, `false`, `Object` (options)) |
| `minifyJS` | Minify JavaScript in script elements and event attributes (uses [UglifyJS](https://github.com/mishoo/UglifyJS2)) | `false` (could be `true`, `false`, `Object` (options)) |
Expand Down
3 changes: 0 additions & 3 deletions assets/master.css
Expand Up @@ -19,9 +19,6 @@ button { font-weight: bold; width: 100px; }
#options label + input { margin-left: 0.5em; }
#stats { margin-bottom: 2em; overflow: hidden; margin-top: 0; }
#todo { font-family: monospace; margin-bottom: 2em; }
#lint-report { font-family: monospace; }
#report { margin-bottom: 5em; }
#report ul { margin: 0.5em; padding-left: 1em; list-style: none; }

.success { color: green; }
.failure { color: red; }
Expand Down
15 changes: 0 additions & 15 deletions assets/master.js
Expand Up @@ -2,7 +2,6 @@
'use strict';

var minify = require('html-minifier').minify;
var HTMLLint = require('html-minifier/src/htmllint').HTMLLint;

function byId(id) {
return document.getElementById(id);
Expand Down Expand Up @@ -31,12 +30,6 @@
}
}
switch (key) {
case 'lint':
if (!value) {
return;
}
value = new HTMLLint();
break;
case 'maxLineLength':
value = parseInt(value);
break;
Expand All @@ -61,7 +54,6 @@
byId('minify-btn').onclick = function() {
try {
var options = getOptions(),
lint = options.lint,
originalValue = byId('input').value,
minifiedValue = minify(originalValue, options),
diff = originalValue.length - minifiedValue.length,
Expand All @@ -75,13 +67,6 @@
'. Minified size: <strong>' + commify(minifiedValue.length) + '</strong>' +
'. Savings: <strong>' + commify(diff) + ' (' + savings + '%)</strong>.' +
'</span>';

if (lint) {
lint.populate(byId('report'));
}
else {
byId('report').innerHTML = '';
}
}
catch (err) {
byId('output').value = '';
Expand Down
8 changes: 0 additions & 8 deletions cli.js
Expand Up @@ -30,7 +30,6 @@
var changeCase = require('change-case');
var concat = require('concat-stream');
var fs = require('fs');
var HTMLLint = require('./src/htmllint').HTMLLint;
var info = require('./package.json');
var minify = require('.').minify;
var path = require('path');
Expand Down Expand Up @@ -114,7 +113,6 @@ var mainOptions = {
ignoreCustomFragments: ['Array of regex\'es that allow to ignore certain fragments, when matched (e.g. <?php ... ?>, {{ ... }})', parseJSONRegExpArray],
includeAutoGeneratedTags: 'Insert tags generated by HTML parser',
keepClosingSlash: 'Keep the trailing slash on singleton elements',
lint: 'Toggle linting',
maxLineLength: ['Max line length', parseInt],
minifyCSS: ['Minify CSS in style elements and style attributes (uses clean-css)', parseJSON],
minifyJS: ['Minify Javascript in script elements and on* attributes (uses uglify-js)', parseJSON],
Expand Down Expand Up @@ -206,9 +204,6 @@ function createOptions() {
options[key] = config[key];
}
});
if (options.lint) {
options.lint = new HTMLLint();
}
return options;
}

Expand Down Expand Up @@ -256,9 +251,6 @@ function writeMinify(content) {
try {
var options = createOptions();
minified = minify(content, options);
if (options.lint) {
options.lint.populate();
}
}
catch (e) {
fatal('Minification error:\n' + e.message);
Expand Down

0 comments on commit 22d1340

Please sign in to comment.