{"name":"htmlnano","version":"2.1.2","keywords":["posthtml","posthtml-plugin","html","postproccessor","minifier"],"author":{"name":"Kirill Maltsev","email":"maltsevkirill@gmail.com"},"license":"MIT","_id":"htmlnano@2.1.2","maintainers":[{"name":"scrum","email":"scrum@list.ru"},{"name":"maltsev","email":"maltsevkirill@gmail.com"}],"homepage":"https://github.com/posthtml/htmlnano","bugs":{"url":"https://github.com/posthtml/htmlnano/issues"},"dist":{"shasum":"94e5deeb7215e177a8b4c5fd98f1356569b9e005","tarball":"http://registry-npm.ywwl.com/htmlnano/download/htmlnano-2.1.2.tgz","fileCount":95,"integrity":"sha512-8Fst+0bhAfU362S6oHVb4wtJj/UYEFr0qiCLAEi8zioqmp1JYBQx5crZAADlFVX0Ly/6s/IQz6G7PL9/hgoJaQ==","signatures":[{"sig":"MEUCIFnD8jr0CxXLItL6acLkbtWV+nWpTrlxnLXDVrw79yMCAiEAiS3jFVpWsApWObdQC8di/XnB/Rh7g3p6/WYjwqRW+qk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1155104,"size":282512,"noattachment":false,"key":"/htmlnano/-/htmlnano-2.1.2.tgz"},"main":"index.cjs","babel":{"plugins":[["@aminya/babel-plugin-replace-import-extension",{"extMapping":{".mjs":".cjs"}}]],"presets":[["@babel/env",{"targets":{"node":10}}]]},"types":"index.d.ts","module":"index.mjs","source":"index.mjs","exports":{".":{"types":"./index.d.ts","import":"./index.mjs","require":"./index.cjs"},"./index.cjs":{"types":"./index.d.cts","require":"./index.cjs"},"./index.mjs":{"types":"./index.d.mts","import":"./index.mjs"}},"gitHead":"8bdd3d81dc6a48cac09f6b09bb9d47904f997dd8","scripts":{"lint":"eslint --fix *.mjs lib/*.mjs lib/**/*.mjs test/*.mjs test/**/*.mjs","test":":","clean":"rimraf lib/*.cjs lib/**/*.cjs","compile":"npm run clean && babel -d lib/ lib/ --out-file-extension .cjs","prepare":"npm run compile","pretest":"npm run lint && npm run compile","posttest":"mocha --timeout 5000 --require @babel/register --recursive --check-leaks --globals addresses"},"_npmUser":{"name":"maltsev","email":"maltsevkirill@gmail.com"},"repository":{"url":"git://github.com/posthtml/htmlnano.git","type":"git"},"_npmVersion":"10.9.2","description":"Modular HTML minifier, built on top of the PostHTML","directories":{},"_nodeVersion":"23.10.0","dependencies":{"posthtml":"^0.16.5","cosmiconfig":"^9.0.0"},"_hasShrinkwrap":false,"devDependencies":{"svgo":"^3.0.2","mocha":"^11.0.1","uncss":"^0.17.3","eslint":"^8.12.0","expect":"^29.0.0","rimraf":"^6.0.0","srcset":"5.0.1","terser":"^5.21.0","cssnano":"^7.0.0","postcss":"^8.3.11","purgecss":"^7.0.2","relateurl":"^0.2.7","@babel/cli":"^7.15.7","@babel/core":"^7.15.5","@babel/register":"^7.15.3","@babel/preset-env":"^7.15.6","@babel/eslint-parser":"^7.17.0","eslint-plugin-import":"^2.28.1","eslint-plugin-path-import-extension":"^0.9.0","@aminya/babel-plugin-replace-import-extension":"1.2.0"},"peerDependencies":{"svgo":"^3.0.2","uncss":"^0.17.3","srcset":"5.0.1","terser":"^5.10.0","cssnano":"^7.0.0","postcss":"^8.3.11","purgecss":"^7.0.2","relateurl":"^0.2.7"},"peerDependenciesMeta":{"svgo":{"optional":true},"uncss":{"optional":true},"srcset":{"optional":true},"terser":{"optional":true},"cssnano":{"optional":true},"postcss":{"optional":true},"purgecss":{"optional":true},"relateurl":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/htmlnano_2.1.2_1746001251443_0.6948830370947572","host":"s3://npm-registry-packages-npm-production"},"readme":"<h1><img src=\"docs/static/logo.png\" alt=\"htmlnano logo\" width=\"90\" align=\"absmiddle\">&nbsp;htmlnano</h1>\n\n[![npm version](https://badge.fury.io/js/htmlnano.svg)](http://badge.fury.io/js/htmlnano)\n![CI](https://github.com/maltsev/htmlnano/actions/workflows/ci.yml/badge.svg)\n\nModular HTML minifier, built on top of the [PostHTML](https://github.com/posthtml/posthtml). Inspired by [cssnano](https://github.com/cssnano/cssnano).\n\n## Documentation\nhttps://htmlnano.netlify.app\n\n\n## Usage\n\n```bash\nnpm install htmlnano\n```\n\n```js\nconst htmlnano = require('htmlnano');\nconst options = {\n    removeEmptyAttributes: false, // Disable the module \"removeEmptyAttributes\"\n    collapseWhitespace: 'conservative' // Pass options to the module \"collapseWhitespace\"\n};\n// posthtml, posthtml-render, and posthtml-parse options\nconst postHtmlOptions = {\n    sync: true, // https://github.com/posthtml/posthtml#usage\n    lowerCaseTags: true, // https://github.com/posthtml/posthtml-parser#options\n    quoteAllAttributes: false, // https://github.com/posthtml/posthtml-render#options\n};\n\nhtmlnano\n    // \"preset\" arg might be skipped (see \"Presets\" section below for more info)\n    // \"postHtmlOptions\" arg might be skipped\n    .process(html, options, preset, postHtmlOptions)\n    .then(function (result) {\n        // result.html is minified\n    })\n    .catch(function (err) {\n        console.error(err);\n    });\n```\n\nAlso, you can use it as CLI tool:\n\n```bash\nnode_modules/.bin/htmlnano --help\n\n# STDIN -> STDOUT\ncat test.html | node_modules/.bin/htmlnano > test.min.html\n\n# Single file\nnode_modules/.bin/htmlnano test.html -o test.min.html\n\n# Multiple files / globs (quote globs so htmlnano expands them itself)\nnode_modules/.bin/htmlnano \"dist/**/*.html\" --output-dir minified\nnode_modules/.bin/htmlnano \"dist/**/*.html\" --in-place\n```\n\nMore usage examples (PostHTML, CLI, Webpack): https://htmlnano.netlify.app/usage\n\n\n## Benchmarks\n\n[html-minifier-terser]: https://www.npmjs.com/package/html-minifier-terser/v/7.2.0\n[html-minifier-next]: https://www.npmjs.com/package/html-minifier-next/v/5.0.3\n[htmlnano]: https://www.npmjs.com/package/htmlnano/v/3.1.0\n[minify]: https://www.npmjs.com/package/@tdewolff/minify/v/2.24.8\n[minify-html]: https://www.npmjs.com/package/@minify-html/node/v/0.18.1\n\n| Website                                                         | Source (KB) | [html-minifier-terser] | [html-minifier-next] | [htmlnano] |  [minify] | [minify-html] |\n| --------------------------------------------------------------- | ----------: | ---------------------: | -------------------: | ---------: | --------: | ------------: |\n| [alistapart.com](https://alistapart.com/)                       |          63 |                   7.6% |                11.6% |      34.6% |     11.1% |          8.6% |\n| [developer.mozilla.org](https://developer.mozilla.org/en-US/)   |         109 |                  38.0% |                41.7% |      52.8% |     40.1% |         39.9% |\n| [css-tricks.com](https://css-tricks.com)                        |          11 |                   8.2% |                34.1% |      37.2% |     18.8% |          8.5% |\n| [en.wikipedia.org](https://en.wikipedia.org/wiki/Main_Page)     |         224 |                   4.5% |                 7.4% |       7.2% |     60.6% |          2.9% |\n| [github.com](https://github.com/)                               |         546 |                   3.0% |                 9.7% |      16.7% |      7.3% |          5.7% |\n| [edri.org](https://edri.org)                                    |          80 |                   7.7% |                12.3% |      30.6% |     12.3% |          8.2% |\n| [leanpub.com](https://leanpub.com)                              |         251 |                   1.3% |                 6.9% |       6.3% |      6.0% |          1.7% |\n| [stackoverflow.blog](https://stackoverflow.blog/)               |         139 |                   3.9% |                 5.7% |       7.0% |      4.6% |          4.7% |\n| [html.spec.whatwg.org](https://html.spec.whatwg.org/multipage/) |         149 |                  -3.9% |                 0.7% |      -2.6% |      0.3% |          0.2% |\n| [eff.org](https://eff.org)                                      |          54 |                   8.8% |                14.7% |      10.9% |     13.4% |          9.7% |\n| [apple.com](https://apple.com/)                                 |         229 |                   8.9% |                12.5% |      11.5% |     10.4% |          9.5% |\n| [w3.org](https://w3.org/)                                       |          50 |                  19.0% |                24.6% |      23.4% |     24.4% |         20.3% |\n| [mastodon.social](https://mastodon.social/explore)              |          37 |                   3.4% |                 6.8% |      14.6% |      5.9% |          3.6% |\n| [bbc.co.uk](https://bbc.co.uk)                                  |         694 |                   0.8% |                 6.3% |       5.9% |      4.7% |          1.2% |\n| [un.org](https://un.org/en/)                                    |         151 |                  14.2% |                22.5% |      41.2% |     20.0% |         15.0% |\n| [lafrenchtech.gouv.fr](https://lafrenchtech.gouv.fr/)           |         152 |                  13.2% |                17.9% |      64.1% |     17.0% |         13.8% |\n| [sitepoint.com](https://sitepoint.com)                          |         497 |                   0.8% |                 7.4% |      12.9% |      6.1% |          0.9% |\n| [faz.net](https://faz.net/aktuell/)                             |        1572 |                   3.4% |                 8.0% |      15.8% |      4.8% |          3.6% |\n| [weather.com](https://weather.com)                              |        2395 |                   0.3% |                11.4% |      18.1% |     11.0% |          0.6% |\n| [tc39.es](https://tc39.es/ecma262/)                             |        7254 |                   8.5% |                11.3% |       9.3% |      9.5% |          9.1% |\n| [home.cern](https://home.cern)                                  |         151 |                  37.1% |                46.4% |      40.2% |     38.9% |         39.5% |\n| **Avg. minify rate**                                            |             |               **9.0%** |            **15.2%** |  **21.8%** | **15.6%** |      **9.9%** |\n\nLatest benchmarks: https://github.com/maltsev/html-minifiers-benchmark (updated daily).\n","publish_time":1746001251683,"_cnpm_publish_time":1746001251683,"dist-tags":{"latest":"3.6.1"}}