posthtml-remove-attributes
PostHTML plugin to remove attributes unconditionally or with content match
Install the posthtml-remove-attributes
:
$ npm install posthtml-remove-attributes --save
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>
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
.