phtml-loader

1.1.0 • Public • Published

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

Package Sidebar

Install

npm i phtml-loader

Weekly Downloads

0

Version

1.1.0

License

CC0-1.0

Unpacked Size

5.08 kB

Total Files

5

Last publish

Collaborators

  • jonathantneal