2.0.3 • Published 14 days ago

vite-plugin-html-mila v2.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
14 days ago

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
     * Default: true for all.
     */
    minifyOptions: {
        collapseWhitespace: true,
        html5: true,
        keepClosingSlash: true,
        minifyCSS: true,
        minifyJS: true,
        removeAttributeQuotes: true,
        removeComments: true,
        removeRedundantAttributes: true,
        removeScriptTypeAttributes: true,
        removeStyleLinkTypeAttributes: true,
        useShortDoctype: true,
    },

    /**
     * List of files to process.
     * Default: {}.
     */
    targets: {
        'target.html'        : 'source.html',
        'example/target.html': 'example/source.html'
    }
}
2.0.3

14 days ago

2.0.2

14 days ago

2.0.1

14 days ago

2.0.0

15 days ago

1.0.7

8 months ago

1.0.6

8 months ago

1.0.5

8 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago