Package Exports
- posthtml-loader
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (posthtml-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
PostHTML Loader
Webpack loader for PostHTML
Install
(sudo) npm i -D webpack
(sudo) npm i -D posthtml-loader
Usage
Setup
// webpack.config.js
module: {
loaders: [
{
test: /\.html$/,
loader: 'html!posthtml'
},
]
},
posthtml: function () {
return {
defaults: [ PostHTML Plugins ]
// Add our own Plugin Packs
}
}
Options
module.exports = {
module: {
loaders: [
{
test: /\.html$/,
loader: 'html!posthtml'
}
{
test: /\.include\.html$/,
loader: 'html!posthtml?pack=includes'
}
]
},
posthtml: function () {
return {
defaults: [ PostHTML Plugins ],
includes: [ PostHTML Plugins ]
}
}
}
Examples
with jade-html-loader
module.exports = {
module: {
loaders: [
{
test: /\.html$/,
loader: 'html!posthtml!jade-html'
}
]
},
posthtml: function () {
return {
defaults: [ PostHTML Plugins ]
}
}
}
with dom-loader
module.exports = {
module: {
loaders: [
{
test: /\.html$/,
loader: 'dom!html!posthtml'
}
]
},
posthtml: function () {
return {
defaults: [ PostHTML Plugins ]
}
}
}
with 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('output.html')
]
}