{"name":"htmlnano","version":"3.6.0","keywords":["posthtml","posthtml-plugin","html","postproccessor","minifier"],"author":{"name":"Kirill Maltsev","email":"maltsevkirill@gmail.com"},"license":"MIT","_id":"htmlnano@3.6.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","test/**"]},"bin":{"htmlnano":"dist/bin.js"},"dist":{"shasum":"d2cfb0db2dca59d8932f6ef8a15bf37f2b2c05ec","tarball":"http://registry-npm.ywwl.com/htmlnano/download/htmlnano-3.6.0.tgz","fileCount":151,"integrity":"sha512-56TNLpxNkWT2dBsdgCG3XVSyzG1iCM11e/JiCib0D1LQ9AOKsVCe0pklDFMbk2wDbAKHsMqwhUoyCci8uvfn6Q==","signatures":[{"sig":"MEQCIG5+IwuunygMRtI6Ewu7yJkyt9juJD6hyXhS+SEmrTigAiAu1aim4G06zYLD1BXvOPvvy/ekScG0rQ0E8A+T1lP0gA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQDJOpnJ0nUY+OBYxxLdvv5ZizYFos3YX4AbB9BhPB6QdwIhAIbszbvdCChhykVRthqgBkrtxnemtt6gu5WS5/6U2Hko","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":528395,"size":131767,"noattachment":false,"key":"/htmlnano/-/htmlnano-3.6.0.tgz"},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"./helpers":{"import":{"types":"./dist/helpers.d.mts","default":"./dist/helpers.mjs"},"require":{"types":"./dist/helpers.d.ts","default":"./dist/helpers.js"}},"./presets/max":{"import":{"types":"./dist/presets/max.d.mts","default":"./dist/presets/max.mjs"},"require":{"types":"./dist/presets/max.d.ts","default":"./dist/presets/max.js"}},"./presets/safe":{"import":{"types":"./dist/presets/safe.d.mts","default":"./dist/presets/safe.mjs"},"require":{"types":"./dist/presets/safe.d.ts","default":"./dist/presets/safe.js"}},"./presets/ampSafe":{"import":{"types":"./dist/presets/ampSafe.d.mts","default":"./dist/presets/ampSafe.mjs"},"require":{"types":"./dist/presets/ampSafe.d.ts","default":"./dist/presets/ampSafe.js"}}},"gitHead":"8d7a14252824946c94c5d8b9ca48efc0244d3119","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 --branches 75 --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 .","test:package":"npm run compile && publint && attw --pack .","lint:markdown":"eslint \"**/*.{md,mdx}\"","lint:duplicates":"jscpd","lint:markdown:fix":"npm run lint:markdown -- --fix"},"_npmUser":{"name":"maltsev","email":"maltsevkirill@gmail.com"},"overrides":{"yargs":"^18.0.0"},"repository":{"url":"git://github.com/maltsev/htmlnano.git","type":"git"},"_npmVersion":"12.0.2","description":"Modular HTML minifier, built on top of the PostHTML","directories":{},"_nodeVersion":"26.7.0","dependencies":{"entities":"^8.0.0","posthtml":"^0.16.5","commander":"^15.0.0","tinyglobby":"^0.2.17","cosmiconfig":"^10.0.0","@types/relateurl":"^0.2.33"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^12.0.0","knip":"^6.0.2","svgo":"^4.0.0","jscpd":"^5.0.5","mocha":"^12.0.0","uncss":"^0.17.3","eslint":"^10.2.0","expect":"^30.1.1","parse5":"^8.0.1","rimraf":"^6.0.0","srcset":"^5.0.1","terser":"^5.21.0","bunchee":"^7.0.0","cssnano":"^9.0.0","globals":"^17.0.0","postcss":"^8.3.11","publint":"^0.3.21","purgecss":"^8.0.0","relateurl":"^0.2.7","@eslint/js":"^10.0.1","fast-check":"^4.8.0","typescript":"^6.0.2","@types/node":"^26.0.0","@types/mocha":"^10.0.10","posthtml-parser":"^0.12.1","posthtml-render":"^3.0.0","eslint-plugin-yml":"^3.8.1","typescript-eslint":"^8.58.1","@swc-node/register":"^1.10.10","@arethetypeswrong/cli":"^0.18.4","eslint-plugin-import-x":"^4.16.2","@stylistic/eslint-plugin":"^5.3.1","eslint-plugin-markdownlint":"^1.0.0","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 || ^8.0.0 || ^9.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.6.0_1791708952188_0.3905380055703991","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\n\n<https://htmlnano.netlify.app>\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## Benchmarks\n\nUpdated: 2026-10-11\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/8.10.7\n[htmlnano]: https://www.npmjs.com/package/htmlnano/v/3.6.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[swc-html]: https://www.npmjs.com/package/@swc/html/v/1.16.18\n\n| Website                                                         | Source (KB) | [html-minifier-terser] | [html-minifier-next] |           [htmlnano] | [minify] | [minify-html] |          [swc-html] |\n| --------------------------------------------------------------- | ----------: | ---------------------: | -------------------: | -------------------: | -------: | ------------: | ------------------: |\n| [developer.mozilla.org](https://developer.mozilla.org/en-US/)   |         119 |                  39.1% | **<ins>41.9%</ins>** |                  N/A |    41.2% |         41.1% |               41.6% |\n| [alistapart.com](https://alistapart.com/)                       |          64 |                   6.8% |                11.0% | **<ins>35.6%</ins>** |    10.3% |          8.0% |               11.0% |\n| [css-tricks.com](https://css-tricks.com/)                       |         150 |                    N/A |                14.1% | **<ins>25.2%</ins>** |    12.6% |          9.1% |               13.3% |\n| [en.wikipedia.org](https://en.wikipedia.org/wiki/Main_Page)     |         247 |                   4.7% |                 7.7% |  **<ins>9.8%</ins>** |     6.0% |          6.1% |                6.3% |\n| [html.spec.whatwg.org](https://html.spec.whatwg.org/multipage/) |         151 |                  -3.9% |                 0.3% |                 0.2% |     0.3% |          0.2% | **<ins>1.5%</ins>** |\n| [edri.org](https://edri.org/)                                   |          84 |                   7.4% |                13.0% | **<ins>32.1%</ins>** |    12.1% |          7.9% |               12.6% |\n| [home.cern](https://home.cern/)                                 |         292 |                    N/A |                11.7% | **<ins>24.5%</ins>** |     8.0% |          4.7% |               10.2% |\n| [mastodon.social](https://mastodon.social/explore)              |          50 |                   3.8% | **<ins>13.3%</ins>** | **<ins>13.3%</ins>** |     5.7% |          7.0% |                8.3% |\n| [leanpub.com](https://leanpub.com/)                             |         524 |                   1.2% |                 8.9% |  **<ins>9.5%</ins>** |     5.3% |          1.7% |                5.8% |\n| [stackoverflow.blog](https://stackoverflow.blog/)               |         134 |                   4.0% |                 7.0% |  **<ins>7.1%</ins>** |     4.6% |          4.9% |                5.5% |\n| [weather.com](https://weather.com/)                             |         360 |                   0.5% |                 8.3% |  **<ins>8.6%</ins>** |     6.4% |          0.9% |                6.4% |\n| [eff.org](https://eff.org/)                                     |          54 |                   8.6% | **<ins>15.6%</ins>** |                14.9% |    13.1% |         11.1% |               13.1% |\n| [apple.com](https://apple.com/)                                 |         248 |                   6.1% |                 8.6% |  **<ins>9.1%</ins>** |     7.6% |          6.7% |                7.0% |\n| [w3.org](https://w3.org/)                                       |          50 |                  17.9% | **<ins>23.3%</ins>** |                23.0% |    22.9% |         19.0% |               22.9% |\n| [bbc.co.uk](https://bbc.co.uk/)                                 |         752 |                   0.8% |                 7.1% |  **<ins>7.3%</ins>** |     4.8% |          1.2% |                6.3% |\n| [un.org](https://un.org/en/)                                    |         161 |                  13.5% |                22.4% | **<ins>42.2%</ins>** |    19.1% |         14.3% |               16.7% |\n| [github.com](https://github.com/)                               |         564 |                   1.5% | **<ins>15.2%</ins>** |                  N/A |     5.2% |          4.1% |                4.6% |\n| [faz.net](https://faz.net/aktuell/)                             |        1366 |                   3.9% |                10.6% | **<ins>16.6%</ins>** |     4.3% |          4.3% |                9.4% |\n| [tc39.es](https://tc39.es/ecma262/)                             |        7450 |                   5.7% |  **<ins>8.1%</ins>** |                 7.5% |     6.6% |          6.2% |                7.9% |\n| [lafrenchtech.gouv.fr](https://lafrenchtech.gouv.fr/)           |         184 |                  26.4% |                30.6% | **<ins>68.3%</ins>** |    29.8% |         26.9% |               30.5% |\n| **Avg. minify rate**                                            |             |               **6.7%** |            **12.2%** |            **19.1%** | **9.9%** |      **7.9%** |           **10.7%** |\n\nLatest benchmarks: <https://github.com/maltsev/html-minifiers-benchmark> (updated daily).\n","publish_time":1791708952292,"_cnpm_publish_time":1791708952292,"dist-tags":{"latest":"3.6.1"}}