Minify CSS and HTML literals inside JavaScript/TypeScript template literal strings. Version 2.0.1 is current stable. Uses html-minifier-next for HTML and lightningcss for CSS. Differentiators: supports TypeScript sources, source maps, and custom tag names. ESM-only, requires Node >=22. Active development.
npm install minify-literalsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage: minify HTML and CSS template literals in a JS/TS source string, outputting minified code and a source map.
Update imports and options. Use named export `minifyHTMLLiterals` instead of `minifyHTMLLiterals` (note: same name). Refer to docs.
Upgrade Node.js to v22 or later.
Use `import` syntax. If you must use CJS, use dynamic import: `const { minifyHTMLLiterals } = await import('minify-literals')`.Use `html: { ... }` and `css: { ... }` directly in options.Explicitly set `sourceMap: false` in options if not needed.
Use `import` syntax or dynamic `import()` instead.
Check import: use `import { minifyHTMLLiterals } from 'minify-literals'`.Run `npm install html-minifier-next lightningcss`.
Upgrade Node.js to v22 or later.