Layout extension for the HTML Webpack Plugin
Enhances html-webpack-plugin
functionality by adding the {layout: 'layoutPath', replace : 'replaceStr'}
option.
This is an extension plugin for the webpack plugin html-webpack-plugin - a plugin that simplifies the creation of HTML files to serve your webpack bundles.
Installation
You must be running webpack on node 0.12.x or higher
Install the plugin with npm:
$ npm install --save-dev layout-webpack-html-plugin
Basic Usage
Add the plugin to your webpack config as follows:
plugins:
The above configuration will actually do nothing due to the configuration defaults.
As soon as you now set layout
to a path the generated output of the HtmlWebpackPlugin will
always add a layout.
plugins: layout: path
page.html
hello i'm div in page
layout.html
hello i'm layout {{ content }}
Result :
hello i'm layout hello i'm div in page
Even if you generate multiple files make sure that you add the LayoutWebpackPlugin only once:
plugins: filename: 'demo.html' filename: 'test.html' layout : './src/layout.html'