# postcss-discard-duplicates

> Discard duplicate rules in your CSS files with PostCSS.

Latest version **9.0.4** (published 2026-09-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install postcss-discard-duplicates
pnpm add postcss-discard-duplicates
yarn add postcss-discard-duplicates
bun add postcss-discard-duplicates
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 9.0.4 |
| Published | 2026-09-27 |
| First published | 2015-03-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4977 |
| Author | Ben Briggs |
| Maintainers | beneb, trysound, ludovicofischer, ai, chriseppstein, andyjansson, evilebottnawi, cssnano-bot |
| Keywords | css, dedupe, optimise, postcss, postcss-plugin |

## Links

- npm: https://www.npmjs.com/package/postcss-discard-duplicates
- Repository: https://github.com/cssnano/cssnano
- Issues: https://github.com/cssnano/cssnano/issues
- npm.io page: https://npm.io/package/postcss-discard-duplicates

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 9.0.4 (latest) — 2026-09-27
- 5.0.0-rc.2 (next) — 2021-03-15
- 4.0.0-nightly.2020.2.6 (nightly) — 2021-02-06
- 9.0.3 — 2026-09-17
- 9.0.2 — 2026-09-05
- 9.0.1 — 2026-09-01
- 9.0.0 — 2026-08-27
- 8.0.4 — 2026-08-16
- 8.0.3 — 2026-08-09
- 8.0.2 — 2026-08-04
- 8.0.1 — 2026-06-11
- 8.0.0 — 2026-05-06
- 7.0.4 — 2026-05-02
- 7.0.3 — 2026-04-20
- 7.0.2 — 2025-05-06
- … 48 more at https://npm.io/package/postcss-discard-duplicates/versions

## README

# [postcss][postcss]-discard-duplicates

> Discard duplicate rules in your CSS files with PostCSS.

## Install

With [npm](https://npmjs.org/package/postcss-discard-duplicates) do:

```
npm install postcss-discard-duplicates --save
```

## Example

This module will remove all duplicate rules from your stylesheets. It works on
at rules, normal rules and declarations. Note that this module does not have any
responsibility for normalising declarations, selectors or whitespace, so that it
considers these two rules to be different:

```css
h1, h2 {
    color: blue;
}

h2, h1 {
    color: blue;
}
```

It has to assume that your rules have already been transformed by another
processor, otherwise it would be responsible for too many things.

### Input

```css
h1 {
    margin: 0 auto;
    margin: 0 auto
}

h1 {
    margin: 0 auto
}
```

### Output

```css
h1 {
    margin: 0 auto
}
```

## Usage

See the [PostCSS documentation](https://github.com/postcss/postcss#usage) for
examples for your environment.


## Contributors

See [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/main/CONTRIBUTORS.md).


## License

MIT © [Ben Briggs](https://beneb.info)


[postcss]: https://github.com/postcss/postcss

---
_Source: https://npm.io/package/postcss-discard-duplicates · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
