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
Loader for PostHTML
| Branch | Build | Coverage |
|---|---|---|
| Master | ||
| Develop | ||
| Release v1.0.0 |
Install
(sudo) npm i -D html-loader posthtml-loaderUsage
Setup
// webpack.config.js
module: {
loaders: [
{
test: /\.html$/,
loader: 'html!posthtml'
},
]
},
posthtml: () => {
return {
defaults: [ /* PostHTML Plugins */ ]
}
}Options
// webpack.config.js
module: {
loaders: [
{
test: /\.html$/,
loader: 'html!posthtml?pack=html'
}
]
},
posthtml: () => {
return {
defaults: [],
html: [ /* PostHTML Plugins */ ],
}
}Extract Text
// webpack.config.js
const ExtractText = require('extract-text-webpack-plugin')
module: {
loaders: [
{
test: /\.html$/,
loader: ExtractText.extract('html!posthtml')
}
]
},
posthtml: () => {
return {
defaults: [ /* PostHTML Plugins */ ]
}
},
plugins: [
new ExtractText('[name].html')
]Integration
Template Loader
{
test: /\.hbs$/,
loader: 'html!posthtml!template-html?engine=handlebars'
}String
HTML
{
test: /\.html$/,
loader: 'html!posthtml'
}SVG
{
test: /\.svg$/,
loader: 'svg!posthtml'
}File && Val Loader
HTML
{
test: /\.html$/,
loader: 'file?name=[name].[ext]!val!html!posthtml'
}SVG
{
test: /\.svg$/,
loader: 'file?name=[name].[ext]!val!svg!posthtml'
}DOM Loader
HTML
{
test: /\.html$/,
loader: 'dom!html!posthtml'
}SVG
{
test: /\.svg$/,
loader: 'dom!svg!posthtml'
}