{"name":"html-minifier-terser","description":"Highly configurable, well-tested, JavaScript-based HTML minifier.","version":"5.0.4","keywords":["cli","compress","compressor","css","html","htmlmin","javascript","min","minification","minifier","minify","optimize","optimizer","pack","packer","parse","parser","terser","uglifier","uglify"],"homepage":"https://danielruf.github.io/html-minifier-terser/","author":{"name":"Daniel Ruf"},"maintainers":[{"name":"danielruf","email":"kontakt@daniel-ruf.de"}],"contributors":[{"name":"Gilmore Davidson","url":"https://github.com/gilmoreorless"},{"name":"Hugo Wetterberg","email":"hugo@wetterberg.nu"},{"name":"Zoltan Frombach","email":"tssajo@gmail.com"}],"license":"MIT","bin":{"html-minifier-terser":"cli.js"},"main":"src/htmlminifier.js","repository":{"type":"git","url":"git+https://github.com/DanielRuf/html-minifier-terser.git"},"bugs":{"url":"https://github.com/DanielRuf/html-minifier-terser/issues"},"engines":{"node":">=6"},"scripts":{"dist":"grunt dist","test":"grunt test"},"dependencies":{"camel-case":"^4.1.1","clean-css":"^4.2.3","commander":"^4.1.1","he":"^1.2.0","param-case":"^3.0.3","relateurl":"^0.2.7","terser":"^4.6.3"},"devDependencies":{"grunt":"^1.0.4","grunt-browserify":"^5.3.0","grunt-eslint":"^22.0.0","grunt-terser":"^1.0.0","node-qunit-puppeteer":"1.0.13","qunit":"^2.9.2"},"benchmarkDependencies":{"chalk":"^2.4.2","cli-table3":"^0.5.1","iltorb":"^2.4.4","lzma":"^2.3.2","minimize":"^2.2.0","progress":"^2.0.3"},"gitHead":"b3dc2239bfef92d1f0861fd43a649f181723e626","_id":"html-minifier-terser@5.0.4","_nodeVersion":"10.16.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-fHwmKQ+GzhlqdxEtwrqLT7MSuheiA+rif5/dZgbz3GjoMXJzcRzy1L9NXoiiyxrnap+q5guSiv8Tz5lrh9g42g==","shasum":"e8cc02748acb983bd7912ea9660bd31c0702ec32","tarball":"http://registry-npm.ywwl.com/html-minifier-terser/download/html-minifier-terser-5.0.4.tgz","fileCount":9,"unpackedSize":96876,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeTTRtCRA9TVsSAnZWagAAWbYP/R1I+IFtkNL1L/IVwuPh\nEETsKxX0tWGbvwPzA3JDhJjWucJ/hHT7tg7S/j4oX3TGF9q2dpR/4rhjqFNH\nVJNUDSDUHoebK6py+hf5RfQ2Ef4q+ZyqAA0CXgix5OmuuSKBj22qh8xvT6Q+\naOBUnlYE1pGVA3vDcu00njbFEIxm/Og7ZIlaqWMmCeXLH2NjgEbFkmXM/ccD\nNRwlRxoRsS0yELAfNkMcQcPHYpXQ6CWVTLvOZbai6yludXkDmgO0HiEjVC1o\na5ZZu5rxnHLIMAQd2oDrtLgsMjTwjf0IfWGGMFEMtnxTcUoQZluhln0vkZ6n\nJ8t2JGB3VHXEXMic0pde4Vp1ZLVHz/ifaXDaXuCNXFMeeLBfa7SqPVY1AHAh\nSkcjR14GnUX57tC+AuGH0SsDpQsdxPc3ZbMF9C48ItCBfWMwOTpiwnphZ5Gv\njyUDOY8TdyXiOLjv5mhgBJ65Lg+zUYrtqE+eQqUYmhKtD5/j/McGzjkKiFyt\nBeY0s8QLmwryB0IKm1VegML+l8DFFtj+ZBGr3mVe19wej6pHg8YRRzlr7lro\n6zssaT1kxX1O2u8tXE1QYB84VWj1vTlgMt3WSPrsQDgw8bjGX5koiu8LA+1P\nGJX8qb6TJrNqg0/xoVGHQeWe9Jqq/kUvE3tE9Rl6jecciE4Ui9gyYBm6KT+p\n9yvx\r\n=GUfL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDKDZyHjbhJWGpzyqAAy6JwFE3IPnasgAdU1WPierQxpAIgbC0mHIJUfCCgqF9LRn47aITyLXT+WaDUoQ+cCidNsjI="}],"size":27589,"noattachment":false,"key":"/html-minifier-terser/-/html-minifier-terser-5.0.4.tgz"},"_npmUser":{"name":"danielruf","email":"kontakt@daniel-ruf.de"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/html-minifier-terser_5.0.4_1582117996811_0.44078810872786356"},"_hasShrinkwrap":false,"readme":"# HTMLMinifier\n\n[![NPM version](https://img.shields.io/npm/v/html-minifier-terser.svg)](https://www.npmjs.com/package/html-minifier-terser)\n[![Build Status](https://github.com/terser/html-minifier-terser/workflows/CI/badge.svg)](https://github.com/terser/html-minifier-terser/actions?workflow=CI)\n\n[HTMLMinifier](https://terser.org/html-minifier-terser/) is a highly **configurable**, **well-tested**, JavaScript-based HTML minifier.\n\n## Installation\n\nFrom NPM for use as a command line app:\n\n```shell\nnpm install html-minifier-terser -g\n```\n\nFrom NPM for programmatic use:\n\n```shell\nnpm install html-minifier-terser\n```\n\n## Usage\n\n**Note** that almost all options are disabled by default. Experiment and find what works best for you and your project.\n\nFor command line usage please see `html-minifier-terser --help` for a list of available options.\n\n**Sample command line:**\n\n```bash\nhtml-minifier-terser --collapse-whitespace --remove-comments --minify-js true\n```\n\n### Node.js\n\n```js\nconst { minify } = require('html-minifier-terser');\n\nconst result = await minify('<p title=\"blah\" id=\"moo\">foo</p>', {\n  removeAttributeQuotes: true,\n});\nresult; // '<p title=blah id=moo>foo</p>'\n```\n\nSee [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).\n\nAlso see corresponding [Ruby wrapper](https://github.com/stereobooster/html_minifier), and for Node.js, [Grunt plugin](https://github.com/gruntjs/grunt-contrib-htmlmin), [Gulp plugin](https://github.com/pioug/gulp-html-minifier-terser), [Koa middleware wrapper](https://github.com/koajs/html-minifier) and [Express middleware wrapper](https://github.com/melonmanchan/express-minify-html).\n\nFor lint-like capabilities take a look at [HTMLLint](https://github.com/kangax/html-lint).\n\n## Minification comparison\n\nHow 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)?\n\n| Site                                                                         | Original size *(KB)* | HTMLMinifier | minimize | Will Peavy | htmlcompressor.com |\n| ---------------------------------------------------------------------------- |:--------------------:| ------------:| --------:| ----------:| ------------------:|\n| [Google](https://www.google.com/)                                            | 52                   | **48**       | 52       | 54         | n/a                |\n| [Stack Overflow](https://stackoverflow.com/)                                 | 177                  | **143**      | 154      | 154        | n/a                |\n| [HTMLMinifier](https://github.com/kangax/html-minifier)                      | 252                  | **171**      | 230      | 250        | n/a                |\n| [Bootstrap CSS](https://getbootstrap.com/docs/3.3/css/)                      | 271                  | **260**      | 269      | 229        | n/a                |\n| [BBC](https://www.bbc.co.uk/)                                                | 355                  | **324**      | 353      | 344        | n/a                |\n| [Amazon](https://www.amazon.co.uk/)                                          | 466                  | **430**      | 456      | 474        | n/a                |\n| [Twitter](https://twitter.com/)                                              | 469                  | **394**      | 462      | 513        | n/a                |\n| [Wikipedia](https://en.wikipedia.org/wiki/President_of_the_United_States)    | 703                  | **569**      | 682      | 708        | n/a                |\n| [Eloquent Javascript](https://eloquentjavascript.net/1st_edition/print.html) | 870                  | **815**      | 840      | 864        | n/a                |\n| [NBC](https://www.nbc.com/)                                                  | 1701                 | **1566**     | 1689     | 1705       | n/a                |\n| [New York Times](https://www.nytimes.com/)                                   | 1731                 | **1583**     | 1726     | 1680       | n/a                |\n| [ES draft](https://tc39.github.io/ecma262/)                                  | 6296                 | **5538**     | 5733     | n/a        | n/a                |\n\n## Options Quick Reference\n\nMost of the options are disabled by default.\n\n| Option                         | Description     | Default |\n|--------------------------------|-----------------|---------|\n| `caseSensitive`                | Treat attributes in case sensitive manner (useful for custom HTML tags) | `false` |\n| `collapseBooleanAttributes`    | [Omit attribute values from boolean attributes](http://perfectionkills.com/experimenting-with-html-minifier#collapse_boolean_attributes) | `false` |\n| `collapseInlineTagWhitespace`  | Don't leave any spaces between `display:inline;` elements when collapsing. Must be used in conjunction with `collapseWhitespace=true` | `false` |\n| `collapseWhitespace`           | [Collapse white space that contributes to text nodes in a document tree](http://perfectionkills.com/experimenting-with-html-minifier#collapse_whitespace) | `false` |\n| `conservativeCollapse`         | Always collapse to 1 space (never remove it entirely). Must be used in conjunction with `collapseWhitespace=true` | `false` |\n| `continueOnParseError`         | [Handle parse errors](https://html.spec.whatwg.org/multipage/parsing.html#parse-errors) instead of aborting. | `false` |\n| `customAttrAssign`             | Arrays of regex'es that allow to support custom attribute assign expressions (e.g. `'<div flex?=\"{{mode != cover}}\"></div>'`) | `[ ]` |\n| `customAttrCollapse`           | Regex that specifies custom attribute to strip newlines from (e.g. `/ng-class/`) | |\n| `customAttrSurround`           | Arrays of regex'es that allow to support custom attribute surround expressions (e.g. `<input {{#if value}}checked=\"checked\"{{/if}}>`) | `[ ]` |\n| `customEventAttributes`        | Arrays of regex'es that allow to support custom event attributes for `minifyJS` (e.g. `ng-click`) | `[ /^on[a-z]{3,}$/ ]` |\n| `decodeEntities`               | Use direct Unicode characters whenever possible | `false` |\n| `html5`                        | Parse input according to HTML5 specifications | `true` |\n| `ignoreCustomComments`         | Array of regex'es that allow to ignore certain comments, when matched | `[ /^!/, /^\\s*#/ ]` |\n| `ignoreCustomFragments`        | Array of regex'es that allow to ignore certain fragments, when matched (e.g. `<?php ... ?>`, `{{ ... }}`, etc.)  | `[ /<%[\\s\\S]*?%>/, /<\\?[\\s\\S]*?\\?>/ ]` |\n| `includeAutoGeneratedTags`     | Insert tags generated by HTML parser | `true` |\n| `keepClosingSlash`             | Keep the trailing slash on singleton elements | `false` |\n| `maxLineLength`                | Specify a maximum line length. Compressed output will be split by newlines at valid HTML split-points |\n| `minifyCSS`                    | Minify CSS in style elements and style attributes (uses [clean-css](https://github.com/jakubpawlowicz/clean-css)) | `false` (could be `true`, `Object`, `Function(text, type)`) |\n| `minifyJS`                     | Minify JavaScript in script elements and event attributes (uses [Terser](https://github.com/terser/terser)) | `false` (could be `true`, `Object`, `Function(text, inline)`) |\n| `minifyURLs`                   | Minify URLs in various attributes (uses [relateurl](https://github.com/stevenvachon/relateurl)) | `false` (could be `String`, `Object`, `Function(text)`) |\n| `noNewlinesBeforeTagClose`     | Never add a newline before a tag that closes an element | `false` |\n| `preserveLineBreaks`           | Always collapse to 1 line break (never remove it entirely) when whitespace between tags include a line break. Must be used in conjunction with `collapseWhitespace=true` | `false` |\n| `preventAttributesEscaping`    | Prevents the escaping of the values of attributes | `false` |\n| `processConditionalComments`   | Process contents of conditional comments through minifier | `false` |\n| `processScripts`               | Array of strings corresponding to types of script elements to process through minifier (e.g. `text/ng-template`, `text/x-handlebars-template`, etc.) | `[ ]` |\n| `quoteCharacter`               | Type of quote to use for attribute values (' or \") | |\n| `removeAttributeQuotes`        | [Remove quotes around attributes when possible](http://perfectionkills.com/experimenting-with-html-minifier#remove_attribute_quotes) | `false` |\n| `removeComments`               | [Strip HTML comments](http://perfectionkills.com/experimenting-with-html-minifier#remove_comments) | `false` |\n| `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)`) |\n| `removeEmptyElements`          | [Remove all elements with empty contents](http://perfectionkills.com/experimenting-with-html-minifier#remove_empty_elements) | `false` |\n| `removeOptionalTags`           | [Remove optional tags](http://perfectionkills.com/experimenting-with-html-minifier#remove_optional_tags) | `false` |\n| `removeRedundantAttributes`    | [Remove attributes when value matches default.](http://perfectionkills.com/experimenting-with-html-minifier#remove_redundant_attributes) | `false` |\n| `removeScriptTypeAttributes`   | Remove `type=\"text/javascript\"` from `script` tags. Other `type` attribute values are left intact | `false` |\n| `removeStyleLinkTypeAttributes`| Remove `type=\"text/css\"` from `style` and `link` tags. Other `type` attribute values are left intact | `false` |\n| `removeTagWhitespace`          | Remove space between attributes whenever possible. **Note that this will result in invalid HTML!** | `false` |\n| `sortAttributes`               | [Sort attributes by frequency](#sorting-attributes--style-classes) | `false` |\n| `sortClassName`                | [Sort style classes by frequency](#sorting-attributes--style-classes) | `false` |\n| `trimCustomFragments`          | Trim white space around `ignoreCustomFragments`. | `false` |\n| `useShortDoctype`              | [Replaces the `doctype` with the short (HTML5) doctype](http://perfectionkills.com/experimenting-with-html-minifier#use_short_doctype) | `false` |\n\n### Sorting attributes / style classes\n\nMinifier options like `sortAttributes` and `sortClassName` won't impact the plain-text size of the output. However, they form long repetitive chains of characters that should improve compression ratio of gzip used in HTTP compression.\n\n## Special cases\n\n### Ignoring chunks of markup\n\nIf you have chunks of markup you would like preserved, you can wrap them `<!-- htmlmin:ignore -->`.\n\n### Minifying JSON-LD\n\nYou can minify script tags with JSON-LD by setting the option `{ processScripts: ['application/ld+json'] }`. Note that this minification is very rudimentary, it is mainly useful for removing newlines and excessive whitespace. \n\n### Preserving SVG tags\n\nSVG tags are automatically recognized, and when they are minified, both case-sensitivity and closing-slashes are preserved, regardless of the minification settings used for the rest of the file.\n\n### Working with invalid markup\n\nHTMLMinifier **can't work with invalid or partial chunks of markup**. This is because it parses markup into a tree structure, then modifies it (removing anything that was specified for removal, ignoring anything that was specified to be ignored, etc.), then it creates a markup out of that tree and returns it.\n\nInput markup (e.g. `<p id=\"\">foo`)\n\n↓\n\nInternal representation of markup in a form of tree (e.g. `{ tag: \"p\", attr: \"id\", children: [\"foo\"] }`)\n\n↓\n\nTransformation of internal representation (e.g. removal of `id` attribute)\n\n↓\n\nOutput of resulting markup (e.g. `<p>foo</p>`)\n\nHTMLMinifier can't know that original markup was only half of the tree; it does its best to try to parse it as a full tree and it loses information about tree being malformed or partial in the beginning. As a result, it can't create a partial/malformed tree at the time of the output.\n\n## Running benchmarks\n\nBenchmarks for minified HTML:\n\n```shell\ncd benchmarks\nnpm install\nnpm run benchmark\n```\n\n## Running local server\n\n```shell\nnpm run serve\n```\n","publish_time":1582117996920,"_cnpm_publish_time":1582117996920,"dist-tags":{"latest":"7.2.0"}}