![PostHTML logo](https://camo.githubusercontent.com/1cb5ce095fc6bb81e4275a203108d7653a5d1bd53ee7400478822443ea2c9b65/687474703a2f2f706f737468746d6c2e6769746875622e696f2f706f737468746d6c2f6c6f676f2e737667)
(sudo) npm i -D posthtml-loader
![dependencies](https://camo.githubusercontent.com/996bd3705daaaf76f802b6a58fa8c3b08a278be17ca9263ff02945a5e80582db/68747470733a2f2f64617669642d646d2e6f72672f6d69636861656c2d63696e696177736b792f706f737468746d6c2d6c6f616465722e737667)
// webpack.config.js
module: {
loaders: [
{
test: /\.html$/,
loader: 'html!posthtml'
},
]
},
posthtml: function () {
return {
defaults: [ PostHTML Plugins ]
// Add our own Plugin Packs
}
}
module.exports = {
module: {
loaders: [
{
test: /\.html$/,
loader: 'html!posthtml?pack=html'
}
{
test: /\.svg$/,
loader: 'svg!posthtml?pack=svg'
}
]
},
posthtml: function () {
return {
defaults: [],
html: [ PostHTML Plugins ],
svg: [ PostHTML Plugins ]
}
}
}
Extract
extract-text-plugin
var ExtractText = require('extract-text-webpack-plugin')
module.exports = {
module: {
loaders: [
{
test: /\.html$/,
loader: ExtractText.extract('html!posthtml')
}
]
},
posthtml: function () {
return {
defaults: [ PostHTML Plugins ]
}
},
plugins: [
new ExtractText('file.html')
]
}
ejs-html-loader
{ test: /\.ejs$/, loader: 'html!posthtml!ejs-html' }
jade-html-loader
{ test: /\.jade$/, loader: 'html!posthtml!jade-html' }
template-html-loader
{ test: /\.hbs$/, loader: 'html!posthtml!template-html?engine=handlebars' }
html-loader
{ test: /\.html$/, loader: 'html!posthtml' }
svg-loader
{ test: /\.svg$/, loader: 'svg!posthtml' }
xml-loader
{ test: /\.xml$/, loader: 'xml!posthtml' }
file-loader && val-loader
html-loader
{ test: /\.html$/, loader: 'file?name=[name].[ext]!val!html!posthtml' }
svg-loader
{ test: /\.svg$/, loader: 'file?name=[name].[ext]!val!svg!posthtml' }
dom-loader
html-loader
{ test: /\.html$/, loader: 'dom!html!posthtml' }
svg-loader
{ test: /\.svg$/, loader: 'dom!svg!posthtml' }