1 | # [postcss][postcss]-discard-duplicates
|
2 |
|
3 | > Discard duplicate rules in your CSS files with PostCSS.
|
4 |
|
5 | ## Install
|
6 |
|
7 | With [npm](https://npmjs.org/package/postcss-discard-duplicates) do:
|
8 |
|
9 | ```
|
10 | npm install postcss-discard-duplicates --save
|
11 | ```
|
12 |
|
13 | ## Example
|
14 |
|
15 | This module will remove all duplicate rules from your stylesheets. It works on
|
16 | at rules, normal rules and declarations. Note that this module does not have any
|
17 | responsibility for normalising declarations, selectors or whitespace, so that it
|
18 | considers these two rules to be different:
|
19 |
|
20 | ```css
|
21 | h1, h2 {
|
22 | color: blue;
|
23 | }
|
24 |
|
25 | h2, h1 {
|
26 | color: blue;
|
27 | }
|
28 | ```
|
29 |
|
30 | It has to assume that your rules have already been transformed by another
|
31 | processor, otherwise it would be responsible for too many things.
|
32 |
|
33 | ### Input
|
34 |
|
35 | ```css
|
36 | h1 {
|
37 | margin: 0 auto;
|
38 | margin: 0 auto
|
39 | }
|
40 |
|
41 | h1 {
|
42 | margin: 0 auto
|
43 | }
|
44 | ```
|
45 |
|
46 | ### Output
|
47 |
|
48 | ```css
|
49 | h1 {
|
50 | margin: 0 auto
|
51 | }
|
52 | ```
|
53 |
|
54 | ## Usage
|
55 |
|
56 | See the [PostCSS documentation](https://github.com/postcss/postcss#usage) for
|
57 | examples for your environment.
|
58 |
|
59 |
|
60 | ## Contributors
|
61 |
|
62 | See [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).
|
63 |
|
64 |
|
65 | ## License
|
66 |
|
67 | MIT © [Ben Briggs](http://beneb.info)
|
68 |
|
69 |
|
70 | [postcss]: https://github.com/postcss/postcss
|