Lightweight fork / adaptation of html-webpack-plugin
npm install simple-html-webpack-plugin
npm install simple-html-webpack-plugin --save-dev
`
Configuration
You can pass a hash of configuration options to SimpleHtmlWebpackPlugin.
Allowed values are as follows:
- template: [required] Path to the raw HTML template file.
- chunks: string[] [required] Allows you to add only some chunks (e.g. only the unit-test chunk)
- filename: The file to write the HTML to. Defaults to index.html.
- minify: {...} | false Pass html-minifier's options as object to minify the output. Defaults to false.
- hash: true | false if true then append a unique webpack compilation hash to all included scripts and CSS files. This is useful for cache busting. Defaults to false.
- alwaysWriteToDisk: true | false if true saves the file on each emit. Useful when using webpack-dev-server. Default is false
Here is an example webpack config illustrating how to use these options:
`javascript
var SimpleHtmlWebpackPlugin = require('simple-html-webpack-plugin');
var webpackConfig = {
entry: {
app: [ "index.js" ]
},
output: {
path: path.resolve('dist'),
filename: '[name].js'
},
plugins: [
new SimpleHtmlWebpackPlugin({
template: 'index.html',
chunks: ['app'],
alwaysWriteToDisk: true,
})
]
}
``