@sergeymakinen/vite-plugin-html-minimize
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

@sergeymakinen/vite-plugin-html-minimize

tests npm codecov

This plugin is a HTML minimizer/minifier for Vite

Usage

// vite.config.js
import htmlMinimize from '@sergeymakinen/vite-plugin-html-minimize'

export default {
  plugins: [
    htmlMinimize({
      filter: /\.x?html?$/
    })
  ]
}

Options

filter

  • Type: RegExp | ((fileName: string) => boolean)

  • Default: /\.html?$/

    Regular expression or function to filter assets by file name.

minifierOptions

  • Type: import('html-minifier-terser').Options

  • Default:

    {
      collapseWhitespace: true,
      html5: true,
      keepClosingSlash: true,
      minifyCSS: true,
      minifyJS: true,
      removeAttributeQuotes: true,
      removeComments: true,
      removeRedundantAttributes: true,
      removeScriptTypeAttributes: true,
      removeStyleLinkTypeAttributes: true,
      useShortDoctype: true,
    }

    Minifier options passed to html-minifier-terser.

Package Sidebar

Install

npm i @sergeymakinen/vite-plugin-html-minimize

Weekly Downloads

111

Version

2.0.0

License

MIT

Unpacked Size

8.74 kB

Total Files

8

Last publish

Collaborators

  • sergeymakinen