Nationwide Polamorous Matrimony

    posthtml-boolean-attributes

    0.3.1 • Public • Published

    PostHTML Plugin Boolean Attributes

    NPM Deps Build Coverage Standard Code Style

    Doesn't set ="" if set to true, If an array is specified, it will not set the value ['customeBooleanAttr'] for the specified attributes and when specifying ['!customeBooleanAttr'] in the array will exclude attributes.

    Before:

      <script async></script> 

    After:

      <script async=""></script> 

    Install

    npm i posthtml posthtml-boolean-attributes

    Usage

    const fs = require('fs');
    const posthtml = require('posthtml');
    const booleanAttributes = require('posthtml-boolean-attributes');
     
    posthtml()
        .use(booleanAttributes({ /* options */ }))
        .process(html/*, options */)
        .then(result => fs.writeFileSync('./after.html', result.html));

    Options

    boolAttrs

    Type: Boolean|Array<String|RegExp>
    Default: true
    Description: Doesn't set ="" if set to true, if an array is specified, it will not set the value ['customeBooleanAttr'] for the specified attributes and when specifying ['!customeBooleanAttr'] in the array will exclude attributes.

    Contributing

    See PostHTML Guidelines and contribution guide.

    Install

    npm i posthtml-boolean-attributes

    DownloadsWeekly Downloads

    2

    Version

    0.3.1

    License

    MIT

    Unpacked Size

    15.4 kB

    Total Files

    21

    Last publish

    Collaborators

    • avatar