Skip to content

bdadam/rollup-plugin-html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.