0.3.1 • Published 4 years ago

posthtml-boolean-attributes v0.3.1

Weekly downloads
8
License
MIT
Repository
github
Last release
4 years ago

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.

0.3.1

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago