Notice
This is a fork of the official repository rollup-plugin-minify-html-literals because the Rollup dependency version remains at v2, so this repository serves as a temporary fix.
Once the official repository is upgraded to v3, this repository will be archived.
Upgraded to Rollup v4, only need to synchronize types, no code changes.
Install
npm i rollup-plugin-minify-html-literals-v3 -D
Usage
rollup.config.js
import minifyLiterals from 'rollup-plugin-minify-html-literals-v3';
export default {
...
plugins: [minifyLiterals()],
};
Configuration
minifyLiterals({
include: [],
exclude: [],
failOnError: false,
options: null,
minifyHTMLLiterals: null,
filter: null
});
options
fileName | string | | Required. The name of the file, used for syntax parsing and source maps. |
minifyOptions? | html-minifier options | defaultMinifyOptions | Defaults to production-ready minification. |
minifyOptions?.minifyCSS? | clean-css options | defaultMinifyCSSOptions | Uses clean-css defaults. |
shouldMinify? | function | defaultShouldMinify | A function that determines whether or not an HTML template should be minified. Defaults to minify all tagged templates whose tag name contains "html" (case insensitive). |
shouldMinifyCSS? | function | defaultShouldMinifyCSS | A function that determines whether or not a CSS template should be minified. Defaults to minify all tagged templates whose tag name contains "css" (case insensitive). |
Advanced Options
For more detailed configuration, go to minify-html-literals.