Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sergeymakinen/vite-plugin-html-minimize
HTML minimizer/minifier for Vite
https://github.com/sergeymakinen/vite-plugin-html-minimize
html minify minimize vite vite-plugin
Last synced: 19 days ago
JSON representation
HTML minimizer/minifier for Vite
- Host: GitHub
- URL: https://github.com/sergeymakinen/vite-plugin-html-minimize
- Owner: sergeymakinen
- License: mit
- Created: 2021-04-21T19:49:41.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-24T23:23:44.000Z (10 months ago)
- Last Synced: 2024-04-25T19:21:14.080Z (7 months ago)
- Topics: html, minify, minimize, vite, vite-plugin
- Language: TypeScript
- Homepage:
- Size: 1.43 MB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @sergeymakinen/vite-plugin-html-minimize
[![tests](https://github.com/sergeymakinen/vite-plugin-html-minimize/workflows/tests/badge.svg)](https://github.com/sergeymakinen/vite-plugin-html-minimize/actions?query=workflow%3Atests)
[![npm](https://img.shields.io/npm/v/@sergeymakinen/vite-plugin-html-minimize)](https://www.npmjs.com/package/@sergeymakinen/vite-plugin-html-minimize)
[![codecov](https://codecov.io/gh/sergeymakinen/vite-plugin-html-minimize/branch/main/graph/badge.svg)](https://codecov.io/gh/sergeymakinen/vite-plugin-html-minimize)This plugin is a HTML minimizer/minifier for Vite
## Usage
```js
// 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:**
```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](https://github.com/terser/html-minifier-terser#options-quick-reference).