rollup-plugin-html

HTML import plugin for rollup

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
rollup-plugin-html
3640.2.18 years ago8 years agoMinified + gzip package size for rollup-plugin-html in KB

Readme

rollup-plugin-html Build Status
Rollup plugin for loading content of HTML files to use as string variable in JavaScript code.

Installation

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

Usage

import { rollup } from 'rollup';
import html from 'rollup-plugin-html';

rollup({
	entry: 'main.js',
	plugins: [
		html({
			include: '**/*.html'
		})
	]
}).then(...)

Options

include

Type: array or string
Default: **/*.html
A single file pattern, or an array of file patterns to include when importing html files. For more details see rollup-pluginutils.

exclude

Type: array or string
Default: undefined
A single file pattern, or an array of file patterns to exclude when importing html files. For more details see rollup-pluginutils.

htmlMinifierOptions

Type: Object Default: {}
The options which are given to html-minifier
E.g.:
rollup({
	entry: 'main.js',
	plugins: [
		html({
			include: '**/*.html',
			htmlMinifierOptions: {
				collapseWhitespace: true,
				collapseBooleanAttributes: true,
				conservativeCollapse: true,
				minifyJS: true
			}
		})
	]
}).then(...)

License

MIT

Credits

Thanks for Bogdan Chadkin (@TrySound) for his rollup-plugin-string rollup plugin which I used as the basis for this plugin.