webpack-config-htmls (1.0.0)
Maintainer: Geoffrey Dhuyvetters @duivvv
Installation
Install the plugin with npm:
$ npm install webpack-config-htmls --save-dev
Basic Usage
var configHTMLs = ; //config is a webpack config objectconfigentry = configentry;configplugins = configplugins;
This module returns an object with 2 keys.
- entry: Array of html paths to add to config.entry
- plugins: Array of html-webpack-plugin instances
example
/src/ /index.html /pages /about.html
var configHTMLs = ;
finds 2 html files, adds them to entry
console; // ['./src/index.html', './src/pages/about.html']
creates HtmlWebpackPlugin instances and adds them to plugin
console; /* [ new HtmlWebpackPlugin({ template: './src/index.html', filename: 'index.html' }), new HtmlWebpackPlugin({ template: './src/pages/about.html', filename: 'pages/about.html' }), ] */
Configuration
You can pass a hash of configuration options to webpack-config-html
.
base
: folder to look for html files (defaults to './src')custom
: Array with custom option objects (to override default behaviour) (template and filename are required)
custom example:
var configHTMLs = custom: template: './src/pages/foo.html' filename: 'pages/bar.html' ;