vite-plugin-html-mila
v3.0.0
Published
Vite plugin to copy and minify HTML
Downloads
12
Maintainers
Readme
Description
Vite plugin for minimizing html, with the ability to copy html files. Terser is used for minification.
- Minifies HTML when imported in JS files.
- Minifies third-party HTML files.
- Copies third-party HTML files.
Install
yarn add -D vite-plugin-html-mila
Sample vite.config.js
import { defineConfig } from 'vite';
import { HtmlMila } from 'vite-plugin-html-mila';
export default defineConfig ({
/**
* Root directory.
* Required.
*/
root: './src',
plugins: [
HtmlMila(/* options */)
]
});
Options
{
/**
* Write debug to console.
* Default: true.
*/
verbose: true,
/**
* Path to output directory.
* Required.
*/
outDir: '../dist',
/**
* Minify HTML file from targets.
* Default: true.
*/
minify: true,
/**
* Minify HTML file from import in JS files.
* Example: import html from './index.html?raw'
* Default: true.
*/
minifyImport: true,
/** Terser minify options, https://github.com/terser/html-minifier-terser
*/
minifyOptions: {},
/**
* List of files to process.
* Default: {}.
*/
targets: {
'target.html' : 'source.html',
'example/target.html': 'example/source.html'
}
}