A Webpack loader that minifies HTML templates embedded in JavaScript files, targeting lit-html and similar template literal-based libraries (version 1.1.0). Unlike html-minifier, it handles `${}` interpolations without requiring well-formed HTML, applying rules like comment removal and space compression. Lightweight but simplistic, with no active releases since 2020. Differentiators include template literal awareness and minimal configuration, at the cost of robustness against complex nesting.
npm install html-template-minifier-webpackNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows a minimal webpack configuration to minify HTML templates in JS files using the loader.
Avoid deeply nested template literals inside `${}` or use a more robust minifier.If advanced minification is needed, consider using html-minifier-terser or another tool after template processing.
Only use with JavaScript template literal-based HTML templates.
Run 'npm install html-template-minifier-webpack --save-dev'
Ensure the file contains template literals with HTML content, or exclude non-template files from the loader rule.
Upgrade to Webpack 4 or use a different minifier that supports Webpack 5.