UNPKG

html-bundler-webpack-plugin

Version:

Generates complete single-page or multi-page website from source assets. Build-in support for Markdown, Eta, EJS, Handlebars, Nunjucks, Pug. Alternative to html-webpack-plugin.

51 lines (43 loc) 1.09 kB
const Config = require('./Common/Config'); // Note: init config before import any source file Config.init('./config.js'); 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;