mini-html-extract-plugin
v0.2.2
Published
Generate HTML wrapper file(s) for specific entries.
Downloads
3
Maintainers
Readme
mini-html-extract-plugin
Generate HTML wrapper file(s) for specific entries.
Installing
npm install --save-dev mini-html-extract-plugin
Usage
const MiniHtmlExtractPlugin = require('mini-html-extract-plugin');
...
plugins: [
// all entries, '[name].html' found in '[output.path]'
new MiniHtmlExtractPlugin(),
// specific entries
new MiniHtmlExtractPlugin({ entries: ['app', 'subapp'] }),
// filename: '[name].[ext]?[contenthash]'
new MiniHtmlExtractPlugin({ filename: `[name]-filename.html`, entries: ['app'] }),
// template content with builtin placeholders: '[entryName]', '[entryJsFilename]'
new MiniHtmlExtractPlugin({
filename: `[name]-template.html`, entries: ['app'],
template: '<html><body>[entryName]<div id="root"></div><script src="[entryJsFilename]"></script></body></html>'
}),
// template content with custom placeholders: '[xxx]', '[yyy]' ...
new MiniHtmlExtractPlugin({
filename: `[name]-template-placeholder.html`, entries: ['app'],
template: '<html><body>[xxx][yyy][yyy]<div id="root"></div><script src="[entryJsFilename]"></script></body></html>',
placeholder: { xxx: 'a', yyy: 'p' }
}),
// template file(absolute path) with builtin placeholders: '[entryName]', '[entryJsFilename]'
new MiniHtmlExtractPlugin({
filename: `[name]-templatePath.html`, entries: ['app'],
templatePath: path.resolve(__dirname, './test/template.html')
}),
// template file(absolute path) with custom placeholders: '[xxx]', '[yyy]' ...
new MiniHtmlExtractPlugin({
filename: `[name]-templatePath-placeholder.html`, entries: ['app'],
templatePath: path.resolve(__dirname, './test/template-placeholder.html'),
placeholder: { xxx: 'a', yyy: 'p' }
}),
],
...
Building
npm install
npm start
npm test