postcss-deduplicate

PostCSS plugin to remove duplicate class definitions

Usage no npm install needed!

<script type="module">
  import postcssDeduplicate from 'https://cdn.skypack.dev/postcss-deduplicate';
</script>

README

PostCSS Deduplicate

Build Status Code Climate Test Coverage Issue Count Dependency Status Inline docs npm version


PostCSS plugin to remove duplicate class definitions. Based on Kristofer Joseph's rework-deduplicate plugin.

Install

npm i --save

Usage

var dedupe = require('postcss-deduplicate');
var read = require('fs').readFileSync;

var css = postcss([dedupe('')])
  .process(read('path/to/source.css', 'utf8'))
  .then(result => { console.log(result.css.toString()) });

Example

Input:

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

Output:

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