https://github.com/posthtml/posthtml-boolean-attributes
Helps to perform transformations with boolean attributes
https://github.com/posthtml/posthtml-boolean-attributes
Last synced: about 1 year ago
JSON representation
Helps to perform transformations with boolean attributes
- Host: GitHub
- URL: https://github.com/posthtml/posthtml-boolean-attributes
- Owner: posthtml
- License: mit
- Created: 2020-09-28T12:25:36.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-11-09T23:44:31.000Z (over 3 years ago)
- Last Synced: 2024-10-29T21:06:04.067Z (over 1 year ago)
- Language: JavaScript
- Size: 223 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- Contributing: contributing.md
- License: license
Awesome Lists containing this project
README
# PostHTML Plugin Boolean Attributes 
[![NPM][npm]][npm-url]
[![Deps][deps]][deps-url]
[![Build][build]][build-badge]
[![Coverage][cover]][cover-badge]
[![Standard Code Style][style]][style-url]
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:
``` html
```
After:
``` html
```
## Install
> npm i posthtml posthtml-boolean-attributes
## Usage
``` js
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`
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](https://github.com/posthtml/posthtml/tree/master/docs) and [contribution guide](CONTRIBUTING.md).
[npm]: https://img.shields.io/npm/v/posthtml-boolean-attributes.svg
[npm-url]: https://npmjs.com/package/posthtml-boolean-attributes
[deps]: https://david-dm.org/posthtml/posthtml-boolean-attributes.svg
[deps-url]: https://david-dm.org/posthtml/posthtml-boolean-attributes
[style]: https://img.shields.io/badge/code%20style-standard-yellow.svg
[style-url]: http://standardjs.com/
[build]: https://travis-ci.org/posthtml/posthtml-boolean-attributes.svg?branch=master
[build-badge]: https://travis-ci.org/posthtml/posthtml-boolean-attributes?branch=master
[cover]: https://coveralls.io/repos/posthtml/posthtml-boolean-attributes/badge.svg?branch=master
[cover-badge]: https://coveralls.io/r/posthtml/posthtml-boolean-attributes?branch=master