posthtml-remove-duplicates
v0.0.4
Published
Remove duplicate elements from your html
Downloads
292
Maintainers
Readme
Posthtml-remove-duplicates
Installation
$ npm i --save posthtml-remove-duplicates
Usage
<!-- index.html -->
<html>
<body>
<style>.a {color: black;}</style>
<style>.a {color: black;}</style>
</body>
</html>
/* index.js */
var fs = require('fs');
var posthtml = require('posthtml');
posthtml()
.use(require('posthtml-remove-duplicates')('style'))
.process(fs.readFileSync('index.html', 'utf8'))
.then(function(result) {
return result;
/**
* <html>
* <body>
* <style>.a {color: black;}</style>
* </body>
* </html>
*/
});
Api
selector: string
: Selector to match html elements, passed to posthtml-match-helper.
License
MIT © Aleksandr Yakunichev