Rollup plugin that minifies HTML files in the bundle using html-minifier. Current stable version: 2.0.0. Release cadence: low, with infrequent updates. Key differentiators: simple integration with Rollup, supports glob patterns for inclusion/exclusion, and exposes all html-minifier options. Alternative plugins like @rollup/plugin-html focus on HTML generation rather than minification. Note that most html-minifier options are disabled by default, requiring explicit configuration for actual minification.
npm install rollup-plugin-html-minifierVerified import paths — ran on the pinned version, not inferred.
Minifies all HTML files matched by the glob pattern, enabling several html-minifier options for effective compression.
Upgrade Rollup to version 2.10.0 or later.
Set desired options explicitly, e.g., options.collapseWhitespace: true.
Ensure HTML files are part of the Rollup bundle (e.g., through @rollup/plugin-html or a manual emit).
Run npm install rollup-plugin-html-minifier --save-dev
Use import syntax or configure Node.js to handle ESM (e.g., type: 'module' in package.json).
Ensure the HTML file is included in Rollup's bundle and pass explicit options like { removeComments: true }.