CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-html-minifier

Highly configurable, well-tested, JavaScript-based HTML minifier with extensive optimization options

86

1.17x
Overview
Eval results
Files

task.mdevals/scenario-3/

Response HTML Minifier

Transforms HTML markup into a compact form for client responses while keeping semantic meaning intact. All transformations apply by default; setting collapse, simplifyDoctype, or compressAssets to false skips that step.

Capabilities

Collapses whitespace and strips comments

  • Input <div>\n <!-- hero banner -->\n <span> Hi there </span>\n</div> becomes <div><span>Hi there</span></div> @test

Optimizes redundant attributes

  • <button type="submit" disabled="disabled">Send</button> becomes <button disabled>Send</button> @test

Simplifies markup framing

  • <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"><html><body><br/></body></html> becomes <!doctype html><br> @test

Minifies embedded CSS and JS

  • <style> body { color: red; padding: 0 8px; } </style><script> function hi(){ console.log('ok'); } </script> becomes <style>body{color:red;padding:0 8px}</style><script>function hi(){console.log("ok")}</script> @test

Implementation

@generates

API

export interface MinifyRequest {
  html: string;
  collapse?: boolean;
  simplifyDoctype?: boolean;
  compressAssets?: boolean;
}

export function minifyResponse(input: MinifyRequest): string;

Dependencies { .dependencies }

html-minifier { .dependency }

Provides HTML, attribute, and inline CSS/JS minification.

Install with Tessl CLI

npx tessl i tessl/npm-html-minifier

tile.json