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

1.0.4 • Public • Published

vite-plugin-html-minifier

HTML minifier plugin for Vite

Usage

npm install -D vite-plugin-html-minifier
// vite.config.ts
import htmlMinifier from 'vite-plugin-html-minifier'

export default defineConfig({
  plugins: [
    htmlMinifier({
      minify: true,
    }),
  ],
})

Options

Parameter Type Default Description
minify boolean|MinifyOptions true html minify option
filter RegExp|string|((fileName: string) => boolean) - target file filter

minify

  • Type: boolean | MinifyOptions

  • Default: true

    {
        collapseWhitespace: true,
        keepClosingSlash: true,
        removeComments: true,
        removeRedundantAttributes: true,
        removeScriptTypeAttributes: true,
        removeStyleLinkTypeAttributes: true,
        removeEmptyAttributes: true,
        useShortDoctype: true,
        minifyCSS: true,
        minifyJS: true,
        minifyURLs: true,
    }

    MinifierOptions is same as html-minifier-terser options.

filter

  • Type: RegExp | string | ((fileName: string) => boolean)
  • Default: None (All entry point files will be matched)

Readme

Keywords

Package Sidebar

Install

npm i vite-plugin-html-minifier

Weekly Downloads

1,091

Version

1.0.4

License

MIT

Unpacked Size

9.14 kB

Total Files

7

Last publish

Collaborators

  • erm1116