phtml-loader
v1.1.0
Published
Use pHTML with Webpack
Downloads
4
Maintainers
Readme
pHTML Loader
pHTML Loader lets you use pHTML with Webpack.
Install
Add pHTML Loader to your project:
npm install phtml-loader --save-dev
Usage
Use pHTML Loader in your Webpack configuration:
module.exports = {
module: {
rules: [
{
test: /\.html$/,
use: [
{ loader: 'phtml-loader', {
options: {
/* Plugins */
plugins: [], // Array | Plugin | Function
/* Process Options */
processOptions: {} // Object
}
} }
]
}
]
}
}
Options
plugins
The plugins
property determines which pHTML plugins are applied.
{ loader: 'phtml-loader', {
options: {
plugins: require('@phtml/image-alt')
}
} }
{
loader: 'phtml-loader', {
options: {
plugins: [
require('@phtml/image-alt'),
require('@phtml/image-size')({ intrinsicsize: 'intrinsic' })
]
}
} }
processOptions
The processOptions
property determines which pHTML custom settings are
applied.
{ loader: 'phtml-loader', {
options: {
processOptions: {
voidElements: ['path', 'source', 'use']
}
}
} }