grunt-phtml

    3.0.0 • Public • Published

    Grunt pHTML pHTML

    NPM Version Build Status Support Chat

    Grunt pHTML lets you use pHTML with Grunt.

    Install

    Add Grunt pHTML to your project:

    npm install grunt-phtml --save-dev

    Usage

    Use Grunt pHTML in your Gruntfile:

    grunt.loadNpmTasks('grunt-phtml')
     
    grunt.initConfig({
      phtml: {
        options: {
          /* pHTML Plugins */
          plugins: [], // Array | Plugin | Function
     
          /* pHTML Plugins */
          processOptions: {} // Object
        },
        dist: {
          /* One or more files processed as one destination */
          src: 'src/*.html',
          dest: 'build/index.html'
     
          /* One or more files processed as multiple destinations */
          /* files: [{
            expand: true,
            src: 'src/*.html',
            dest: 'dest'
          }] */
        }
      }
    })

    Options

    options.plugins

    The plugins array determines which pHTML plugins are applied.

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

    processOptions

    The processOptions property determines which pHTML custom settings are applied.

    {
      phtml: {
        options: {
          processOptions: {
            voidElements: ['path', 'source', 'use']
          }
        }
      }
    }

    options.separator

    The separator string determines how value multiple sources are joined together. By default, sources are combined with a newline (\n).

    {
      phtml: {
        options: {
          separator: ''
        }
      }
    }

    Install

    npm i grunt-phtml

    DownloadsWeekly Downloads

    4

    Version

    3.0.0

    License

    CC0-1.0

    Unpacked Size

    5.39 kB

    Total Files

    4

    Last publish

    Collaborators

    • jonathantneal