# posthtml-boolean-attributes
**Repository Path**: mirrors_posthtml/posthtml-boolean-attributes
## Basic Information
- **Project Name**: posthtml-boolean-attributes
- **Description**: Helps to perform transformations with boolean attributes
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-09-30
- **Last Updated**: 2025-12-14
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## 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