Skip to content
Use pHTML with Gulp
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.
test
.editorconfig
.gitignore
.travis.yml
CHANGELOG.md
README.md
index.js
package.json
test.js

README.md

Gulp pHTML pHTML

NPM Version Build Status Support Chat

Gulp pHTML lets you use pHTML with Gulp.

Install

Add Gulp pHTML to your project:

npm install gulp-phtml --save-dev

Usage

Use Gulp pHTML in your Gulpfile:

const gulp = require('gulp')
const gulpPhtml = require('gulp-phtml')

gulp.task('html',
  () => gulp.src('./src/*.html').pipe(
    gulpPhtml({
      /* pHTML Plugins */
      plugins: [], // Array | Plugin | Function

      /* pHTML Plugins */
      processOptions: {} // Object
    })
  ).pipe(
    gulp.dest('dist')
  )
)

Options

plugins

The plugins property determines which pHTML plugins are applied.

gulpPhtml({
  plugins: require('@phtml/image-alt')
})
gulpPhtml({
  plugins: [
    require('@phtml/image-alt'),
    require('@phtml/image-size')({ intrinsicsize: 'intrinsic' })
  ]
})

processOptions

The processOptions property determines which pHTML custom settings are applied.

gulpPhtml({
  processOptions: {
    voidElements: ['path', 'source', 'use']
  }
})
You can’t perform that action at this time.