UNPKG

1.58 kBMarkdownView Raw
1# [postcss][postcss]-merge-rules [![Build Status](https://travis-ci.org/ben-eb/postcss-merge-rules.svg?branch=master)][ci] [![NPM version](https://badge.fury.io/js/postcss-merge-rules.svg)][npm] [![Dependency Status](https://gemnasium.com/ben-eb/postcss-merge-rules.svg)][deps]
2
3> Merge CSS rules with PostCSS.
4
5## Install
6
7With [npm](https://npmjs.org/package/postcss-merge-rules) do:
8
9```
10npm install postcss-merge-rules --save
11```
12
13## Examples
14
15This module will attempt to merge *adjacent* CSS rules:
16
17### By declarations
18
19#### Input
20
21```css
22a {
23 color: blue;
24 font-weight: bold
25}
26
27p {
28 color: blue;
29 font-weight: bold
30}
31```
32
33#### Output
34
35```css
36a,p {
37 color: blue;
38 font-weight: bold
39}
40```
41
42### By selectors
43
44#### Input
45
46```css
47a {
48 color: blue
49}
50
51a {
52 font-weight: bold
53}
54```
55
56#### Output
57
58```css
59a {
60 color: blue;
61 font-weight: bold
62}
63```
64
65### By partial declarations
66
67#### Input
68
69```css
70a {
71 font-weight: bold
72}
73
74p {
75 color: blue;
76 font-weight: bold
77}
78```
79
80#### Output
81
82```css
83a,p {
84 font-weight: bold
85}
86
87p {
88 color: blue
89}
90```
91
92## Usage
93
94See the [PostCSS documentation](https://github.com/postcss/postcss#usage) for
95examples for your environment.
96
97## Contributing
98
99Pull requests are welcome. If you add functionality, then please add unit tests
100to cover it.
101
102## License
103
104MIT © [Ben Briggs](http://beneb.info)
105
106[ci]: https://travis-ci.org/ben-eb/postcss-merge-rules
107[deps]: https://gemnasium.com/ben-eb/postcss-merge-rules
108[npm]: http://badge.fury.io/js/postcss-merge-rules
109[postcss]: https://github.com/postcss/postcss