Skip to content
Use pHTML with Webpack
JavaScript HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
.editorconfig
.gitignore
.travis.yml
CHANGELOG.md
README.md
index.js
options.json
package.json

README.md

pHTML Loader pHTML

NPM Version Build Status Support Chat

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']
    }
  }
} }
You can’t perform that action at this time.