rsbuild-plugin-html-minifier-terser
An Rsbuild plugin to use html-minifier-terser to minify the HTML outputs.
Usage
Install:
npm add rsbuild-plugin-html-minifier-terser -D
Basic
Add plugin to your rsbuild.config.ts
, HTML will be minified by default and JS minimization affected by Rsbuild's config.
import { pluginHtmlMinifierTerser } from 'rsbuild-plugin-html-minifier-terser'
export default {
plugins: [pluginHtmlMinifierTerser()],
}
Customize options
The plugin could accept an parameter of type HtmlMinifierOptions | ((options: HtmlMinifierOptions) => HtmlMinifierOptions)
.
-
Passing options to customize the minification, fields listed in the options will override the default options.
export default {
plugins: [
pluginHtmlMinifierTerser({
minifyCSS: false,
}),
],
}
-
A callback function can be passed to the plugin to customize the minification options based on the default options, and the return value will be used as the final options.
export default {
plugins: [
pluginHtmlMinifierTerser((options) => {
return options
}),
],
}
License
MIT.