html-bundler-webpack-plugin
Version:
Generates complete single-page or multi-page website from source assets. Built-in support for Markdown, Eta, EJS, Handlebars, Nunjucks, Pug. Alternative to html-webpack-plugin.
46 lines (40 loc) • 970 B
JavaScript
const AssetCompiler = require('./Plugin/AssetCompiler');
const loader = require.resolve('./Loader');
/**
* @typedef {PluginOptions} HtmlBundlerPluginOptions
*/
class HtmlBundlerPlugin extends AssetCompiler {
/**
* @param {HtmlBundlerPluginOptions|{}} options
*/
constructor(options = {}) {
const PluginOptions = {
enabled: true,
verbose: false,
minify: false,
minifyOptions: null,
sourcePath: null,
outputPath: null,
filename: '[name].html',
postprocess: null,
js: {},
css: {},
extractComments: false,
};
super({
...PluginOptions,
...options,
});
}
/**
* Called when a compiler object is initialized.
* Override abstract method.
*
* @param {Compiler} compiler The instance of the webpack compilation.
*/
init(compiler) {
// do some thing in an extended plugin
}
}
module.exports = HtmlBundlerPlugin;
module.exports.loader = loader;