Loader for PostHTML
(sudo) npm i -D posthtml-loader
// 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 ]
}
}
}
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')
]
}
{ test: /\.ejs$/, loader: 'html!posthtml!ejs-html' }
{ test: /\.jade$/, loader: 'html!posthtml!jade-html' }
Templates supported by consolidate
{ test: /\.hbs$/, loader: 'html!posthtml!template-html?engine=handlebars' }
{ test: /\.html$/, loader: 'html!posthtml' }
{ test: /\.svg$/, loader: 'svg!posthtml' }
{ test: /\.xml$/, loader: 'xml!posthtml' }
{ test: /\.html$/, loader: 'file?name=[name].[ext]!val!html!posthtml' }
{ test: /\.svg$/, loader: 'file?name=[name].[ext]!val!svg!posthtml' }
{ test: /\.html$/, loader: 'dom!html!posthtml' }
{ test: /\.svg$/, loader: 'dom!svg!posthtml' }