HTML minimizer/minifier for Vite
npm install @sergeymakinen/vite-plugin-html-minimize


This plugin is a HTML minimizer/minifier for Vite
``js
// vite.config.js
import htmlMinimize from '@sergeymakinen/vite-plugin-html-minimize'
export default {
plugins: [
htmlMinimize({
filter: /\.x?html?$/
})
]
}
`
- Type: RegExp | ((fileName: string) => boolean)/\.html?$/
- Default:
Regular expression or function to filter assets by file name.
- Type: import('html-minifier-terser').Options`
- Default:
js``
{
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.