Rollup plugin for loading content of HTML files to use as string variable in JavaScript code.
npm install --save-dev rollup-plugin-html
import { rollup } from 'rollup';
import html from 'rollup-plugin-html';
rollup({
entry: 'main.js',
plugins: [
html({
include: '**/*.html'
})
]
}).then(...)
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.
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.
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(...)
MIT
Thanks for Bogdan Chadkin (@TrySound) for his rollup-plugin-string rollup plugin which I used as the basis for this plugin.