1.1.0 • Published 5 years ago

phtml-loader v1.1.0

Weekly downloads
2
License
CC0-1.0
Repository
github
Last release
5 years ago

pHTML Loader

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']
    }
  }
} }