A Rollup plugin (v2.0.1) that minifies HTML in tagged template literals, specifically for lit-html and other HTML-in-JS libraries. Currently stable with active maintenance; released as a compatibility fix for newer Rollup versions (^2.x.x, ^3.x.x, ^4.x.x). Unlike rollup-plugin-minify-html-literals, this plugin supports Rollup v3+ and is written in TypeScript, providing type definitions. It relies on minify-literals under the hood and must run before transpilation. Ideal for reducing bundle size in LitElement or similar projects.
npm install rollup-plugin-html-literalsVerified import paths — ran on the pinned version, not inferred.
Basic Rollup config using the plugin to minify HTML template literals in all JS files, excluding node_modules.
Place template() before transpile plugins in the plugins array.
Use minifyHTMLLiterals option to customize the minification function or configure minify-literals options accordingly.
Refer to minify-literals documentation for custom minification.
Use patterns like 'src/**/*.js' instead of just '*.js'.
Run npm install minify-literals --save-dev
Use import template from 'rollup-plugin-html-literals'
Move template() before transpile plugins in plugins array.
Upgrade Rollup to ^2.0.0 or later, or use rollup-plugin-minify-html-literals for older versions.