rework-deduplicate

Rework plugin to remove duplicate rules

rework-deduplicate

Rework plugin to remove duplicate class definitions

npm i --save

var rework = require('rework'),
    dedupe = require('rework-deduplicate'),
    read = require('fs').readFileSync,
    output;
 
    output = rework(read('path/to/source.css', 'utf8'))
        .use(dedupe());

Input:

.button {
    background: black;
}
.button {
    background: red;
}
.button {
    background: black;
}

Output:

.button {
    background: black;
}
.button {
    background: red;
}