{"id":42346,"library":"your-html-minifier","title":"your-html-minifier","description":"your-html-minifier is a Koa middleware for minifying HTML responses using the popular html-minifier library. Version 0.2.0 provides a simple integration for Koa 2.x, allowing developers to easily enable HTML minification with options like collapseWhitespace, minifyCSS, and minifyJS. Compared to the original koajs/html-minifier, this package offers similar functionality but is maintained under the yourjs organization. The release cadence is not well documented, but it is a lightweight wrapper around the well-established html-minifier package.","status":"active","version":"0.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/yourjs/your/tree/master/packages/your-html-minifier","tags":["javascript"],"install":[{"cmd":"npm install your-html-minifier","lang":"bash","label":"npm"},{"cmd":"yarn add your-html-minifier","lang":"bash","label":"yarn"},{"cmd":"pnpm add your-html-minifier","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core minification engine for HTML, CSS, and JS.","package":"html-minifier","optional":false}],"imports":[{"note":"The module exports a single function as default. Named import will not work.","wrong":"import { htmlMinifier } from 'your-html-minifier'","symbol":"default","correct":"import htmlMinifier from 'your-html-minifier'"},{"note":"CommonJS require returns the default export directly, not an object.","wrong":"const { htmlMinifier } = require('your-html-minifier')","symbol":"default","correct":"const htmlMinifier = require('your-html-minifier')"},{"note":"Using default as a named import is unnecessary and may cause confusion.","wrong":"import { default as hM } from 'your-html-minifier'","symbol":"default","correct":"import hM from 'your-html-minifier'"}],"quickstart":{"code":"import Koa from 'koa';\nimport htmlMinifier from 'your-html-minifier';\n\nconst app = new Koa();\n\napp.use(htmlMinifier({\n  collapseWhitespace: true,\n  minifyCSS: true,\n  minifyJS: true\n}));\n\napp.use(async (ctx) => {\n  ctx.body = '<html><head></head><body>   Hello World   </body></html>';\n});\n\napp.listen(3000);","lang":"javascript","description":"Demonstrates how to use the htmlMinifier middleware in a Koa 2.x application with common minification options."},"warnings":[{"fix":"Refer to https://github.com/kangax/html-minifier#options-quick-reference for all available options.","message":"This package is a thin wrapper around html-minifier and inherits its options. Ensure you understand the html-minifier option documentation.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure your project uses Koa 2.x. For Koa 1.x, consider using koajs/html-minifier instead.","message":"Possible breaking change if upgrading from earlier versions without proper peer dependency on Koa 2.x.","severity":"breaking","affected_versions":"<0.2.0"},{"fix":"Consider using html-minifier-terser or other actively maintained alternatives.","message":"The package might not be actively maintained. No recent updates as of 2023.","severity":"deprecated","affected_versions":"all"}],"env_vars":null,"search_vec":"'0.2.0':25 '2':32 'allow':34 'around':78 'cadenc':67 'collapsewhitespac':44 'compar':48 'develop':35 'document':71 'easili':37 'enabl':38 'establish':82 'function':57 'html':3,7,15,21,39,84 'html-minifi':20,83 'integr':29 'javascript':87 'koa':11,31 'koajs/html-minifier':52 'librari':23 'lightweight':76 'like':43 'maintain':60 'middlewar':12 'minif':40 'minifi':4,8,14,22,85 'minifycss':45 'minifyj':47 'offer':55 'option':42 'organ':64 'origin':51 'packag':54,86 'popular':19 'provid':26 'releas':66 'respons':16 'similar':56 'simpl':28 'use':17 'version':24 'well':70,81 'well-establish':80 'wrapper':77 'x':33 'your-html-minifi':1,5 'yourj':63","created_at":"2026-06-04T18:56:48.729398+00:00","updated_at":"2026-06-04T18:56:48.729398+00:00","problems":[{"fix":"Use 'import htmlMinifier from \"your-html-minifier\"' instead of 'import { htmlMinifier } from \"your-html-minifier\"'.","cause":"Using named import instead of default import in ESM.","error":"TypeError: htmlMinifier is not a function"},{"fix":"Use 'import htmlMinifier from \"your-html-minifier\"' and apply as middleware.","cause":"Trying to use html-minifier directly without the wrapper.","error":"html-minifier is not a function"},{"fix":"Run 'npm install html-minifier' in your project.","cause":"Missing dependency on html-minifier. It should be automatically installed as a peer dependency.","error":"Cannot find module 'html-minifier'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/yourjs/your/tree/master/packages/your-html-minifier","github":"https://github.com/yourjs/your/tree/master/packages/your-html-minifier","docs":null,"changelog":null,"pypi":null,"npm":"your-html-minifier","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}