rsbuild-plugin-html-minifier-terser
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

rsbuild-plugin-html-minifier-terser

An Rsbuild plugin to use html-minifier-terser to minify the HTML outputs.

npm version license

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.

// rsbuild.config.ts
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).

  1. Passing options to customize the minification, fields listed in the options will override the default options.

    export default {
      plugins: [
        pluginHtmlMinifierTerser({
          // `minifyCSS` will be set to false
          minifyCSS: false,
        }),
      ],
    }
  2. 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) => {
          // customize options here
          return options
        }),
      ],
    }

License

MIT.

Readme

Keywords

none

Package Sidebar

Install

npm i rsbuild-plugin-html-minifier-terser

Weekly Downloads

9,566

Version

1.1.1

License

MIT

Unpacked Size

13 kB

Total Files

7

Last publish

Collaborators

  • chenjiahan