PostCSS plugin to remove duplicate css between multiple files
Last updated 2 years ago by gatsbill .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install postcss-slash-css 
SYNC missed versions from official npm registry.


Build Status

A PostCSS plugin that removes duplicates css properties and selector accross multiples css files.


npm install postcss-slash-css

This plugin only supports node v8.0.0 and over.


const postcss = require("postcss");
const slashCSS = require("");

postcss([slashCSS({ targets: "**/*.css" })]);

See PostCSS docs for examples for your environment.

Example with gulp :

const postcss = require('gulp-postcss');
const gulp = require('gulp');
const slashCSS = require("../../index");

const inputFilePath = "../assets/normal.css";
const targetFilePath = "../assets/*.critical.css";
const outputFilePath = "./result.css";

// plugin we will use in postcss
const pluginsUsed = [
  slashCSS({ targets: targetFilePath })

gulp.task('css', function () {
  return gulp.src(inputFilePath)



  • Type: string (glob using fast-glob)
  • Required

CSS files to search duplicates within source file.


  • Type: string (not case sensitive)
  • Optional
  • Default: MatchAtleastOne

Can be MatchAtleastOne or MatchAll.

If MatchAll is used, css will be removed only if it is present in ALL targets files. If MatchAtleastOne is used, css will be removed when it is present ATLEAST in one of targets css files.


  • Type: boolean
  • Optional
  • Default: true

if false two properties are equals even if one has important and the other does not have it.


To test this plugin, just run :

npm test


You can see multiples exemples in the example folder.


This software is released under the terms of the MIT license.

Current Tags

  • 1.1.0                                ...           latest (2 years ago)

3 Versions

  • 1.1.0                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (2)
Dev Dependencies (2)
Dependents (0)

Copyright 2014 - 2016 © |