{"name":"htmlnano","version":"3.3.0","keywords":["posthtml","posthtml-plugin","html","postproccessor","minifier"],"author":{"name":"Kirill Maltsev","email":"maltsevkirill@gmail.com"},"license":"MIT","_id":"htmlnano@3.3.0","maintainers":[{"name":"scrum","email":"scrum@list.ru"},{"name":"maltsev","email":"maltsevkirill@gmail.com"}],"homepage":"https://github.com/maltsev/htmlnano","bugs":{"url":"https://github.com/maltsev/htmlnano/issues"},"c8":{"exclude":["dist/**/*.js","dist/**/*.cjs"]},"bin":{"htmlnano":"dist/bin.js"},"dist":{"shasum":"d7e921f4cdb227acb66ed6fdd5f1193892fa03b8","tarball":"http://registry-npm.ywwl.com/htmlnano/download/htmlnano-3.3.0.tgz","fileCount":123,"integrity":"sha512-0wS+AbqwHpIkaGoYfdNIpgwdLC61oYS3GRRNBCEsgEhVDKj8eYJhdhnYIS655NW4tcytnPxJJiWQa8/52sWGyA==","signatures":[{"sig":"MEUCIQDdvSVrWk6pvA6y4+BB5HbUY3lxjNybwbDjyyOWwgx5+gIgUugKLciKgIe/t2KGV93cu49S42zkqHUHrdUaz3mXiy8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":576691,"size":67124,"noattachment":false,"key":"/htmlnano/-/htmlnano-3.3.0.tgz"},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./helpers":{"types":"./dist/helpers.d.ts","import":"./dist/helpers.mjs","require":"./dist/helpers.js"},"./presets/max":{"types":"./dist/presets/max.d.ts","import":"./dist/presets/max.mjs","require":"./dist/presets/max.js"},"./presets/safe":{"types":"./dist/presets/safe.d.ts","import":"./dist/presets/safe.mjs","require":"./dist/presets/safe.js"},"./presets/ampSafe":{"types":"./dist/presets/ampSafe.d.ts","import":"./dist/presets/ampSafe.mjs","require":"./dist/presets/ampSafe.js"}},"gitHead":"bcba2854c58ac68cad881ce3914a17e00c96626c","scripts":{"lint":"npm run lint:eslint && npm run lint:duplicates && npm run lint:knip","test":"c8 -r text -r html npm run test:mocha","build":"npm run clean && bunchee","clean":"rimraf dist coverage","compile":"npm run build","prepare":"npm run compile","pretest":"npm run lint && npm run compile && npm run test:types","release":"node scripts/release.js","posttest":"c8 check-coverage --lines 85 --per-file","lint:knip":"knip","postbuild":"chmod +x dist/bin.js","test:mocha":"mocha --timeout 5000 --require @swc-node/register --recursive --ignore 'test/typecheck/**/*.ts' --check-leaks --globals addresses 'test/**/*.ts'","test:types":"tsc --noEmit -p tsconfig.typecheck.json","lint:eslint":"eslint --fix .","lint:duplicates":"jscpd"},"_npmUser":{"name":"maltsev","email":"maltsevkirill@gmail.com"},"overrides":{"yargs":"^18.0.0"},"repository":{"url":"git://github.com/maltsev/htmlnano.git","type":"git"},"_npmVersion":"11.13.0","description":"Modular HTML minifier, built on top of the PostHTML","directories":{},"_nodeVersion":"26.0.0","dependencies":{"posthtml":"^0.16.5","commander":"^14.0.0","cosmiconfig":"^9.0.0","@types/relateurl":"^0.2.33"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^11.0.0","knip":"^6.0.2","svgo":"^4.0.0","jscpd":"^4.0.8","mocha":"^11.0.1","uncss":"^0.17.3","eslint":"^10.2.0","expect":"^30.1.1","rimraf":"^6.0.0","srcset":"^5.0.1","terser":"^5.21.0","bunchee":"^6.5.1","cssnano":"^8.0.0","globals":"^17.0.0","postcss":"^8.3.11","purgecss":"^8.0.0","relateurl":"^0.2.7","@eslint/js":"^10.0.1","typescript":"^6.0.2","@types/node":"^25.0.0","@types/mocha":"^10.0.10","typescript-eslint":"^8.58.1","@swc-node/register":"^1.10.10","eslint-plugin-import-x":"^4.16.2","@stylistic/eslint-plugin":"^5.3.1","eslint-config-flat-gitignore":"^2.3.0","eslint-plugin-unused-imports":"^4.4.1"},"peerDependencies":{"svgo":"^4.0.0","uncss":"^0.17.3","srcset":"^5.0.1","terser":"^5.21.0","cssnano":"^7.0.0","postcss":"^8.3.11","purgecss":"^8.0.0","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_3.3.0_1778947833547_0.07862698802489665","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":1778947833698,"_cnpm_publish_time":1778947833698,"dist-tags":{"latest":"3.6.1"}}