Socket
Book a DemoInstallSign in
Socket

posthtml-boolean-attributes

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

posthtml-boolean-attributes

Helps to perform transformations with boolean attributes

latest
Source
npmnpm
Version
0.3.1
Version published
Maintainers
1
Created
Source

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.

Keywords

html

FAQs

Package last updated on 01 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts