html-webpack-plugin-combiner

0.0.3 • Public • Published

html-webpack-plugin-combiner

html-webpack-plugin-combiner is a wrap library for html-webpack-plugin.

If you specify the root directory of the source to be an html page, it will return an array instantiated with html-webpack-plugin.

Installation

npm install --save html-webpack-plugin-combiner

Usage

webpack.config.js

Before

const HtmlWebpackPlugin = require("html-webpack-plugin");
const PATH_SRC = './src';
const htmlList = [
  new HtmlWebpackPlugin({
    template: `${PATH_SRC}/pug/page/index.pug`,
    inject: false
  }),
  new HtmlWebpackPlugin({
    filename: "sub/index.html",
    template: `${PATH_SRC}/pug/page/sub/index.pug`,
    inject: false
  })
];

module.exports = {
  plugins: [
    ...htmlList
  ]
};

After

const HtmlWebpackPluginCombiner = require("html-webpack-plugin-combiner");

const pugSrcRoute = "src/pug/page/";
const htmlList = new HtmlWebpackPluginCombiner(pugSrcRoute).htmlList;

module.exports = {
  plugins: [
    ...htmlList
  ]
};

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i html-webpack-plugin-combiner

Weekly Downloads

7

Version

0.0.3

License

MIT

Unpacked Size

3.16 kB

Total Files

3

Last publish

Collaborators

  • okawa-h