posthtml-remove-attributes
May 15, 2017 ยท View on GitHub
PostHTML plugin to remove attributes unconditionally or with content match
Installation
Install the posthtml-remove-attributes:
$ npm install posthtml-remove-attributes --save
Usage
var posthtml = require('posthtml');
var removeAttributes = require('posthtml-remove-attributes');
var html = '<div style="display: inline;" class="wow">OMG</div>';
posthtml([
removeAttributes([ // The only non-array argument is also possible
'class', // match name
{name: 'style', value: /inline/} // match name and value
])
])
.process(html)
.then(function(result) {
console.log(result);
});
// Yields:
// <div>OMG</div>
Contribution guidelines
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using npm test.