1.0.0 • Published 1 year ago

rollup-plugin-minify-html v1.0.0

Weekly downloads
15
License
MIT
Repository
github
Last release
1 year ago

rollup-plugin-minify-html

Minify html files with html-minifer

Installation

# yarn
yarn add -D rollup-plugin-minify-html

# npm
npm install rollup-plugin-minify-html --save-dev

Usage

// rollup.config.js
import { minifyHTML } from "rollup-plugin-minify-html";

export default {
	input: "src/index.js",
	output: {
		file: "dist/bundle.js",
		format: "iife"
	},
	plugins: [
		minifyHTML({
			targets: [
				{
					src: "public/index.html",
					dest: "dist/index.html",
					minifyOptions: {
						minifyJS: true
					}
				}
			],
			minifierOptions: {
				collapseWhitespace: true,
				minifyCSS: true,
				minifyJS: false,
				minifyURLs: true
			}
		})
	]
}

Configuration

The configuration options are:

minifierOptions

Options passed to html-minifier, that applies to all targets. See html-minifier options.

targets

Type: Array | Default: []

Array of target html files to minimize. Each target has properties:

  • src (string): Path to the source html file
  • dest (string): Path to the destination file
  • minifierOptions (Object): Options passed to html-minifier for this target

Each target must have a src and a dest. minifierOptions are optional and will override the global minifierOptions for this target. See html-minifier options.

hook

Type: string | Default: buildEnd

Rollup hook the plugin should use. By default, plugin runs when rollup has finished bundling, before bundle is written to disk.

Original Author

Arpit Chakladar

License

MIT

1.0.0

1 year ago

0.1.3

1 year ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.1

3 years ago