postcss-merge-rules
TypeScript icon, indicating that this package has built-in type declarations

1.2.2 • Public • Published

postcss-merge-rules Build Status NPM version Dependency Status

Merge CSS rules with PostCSS.

Install via npm:

npm install postcss-merge-rules --save

Example

var postcss = require('postcss');
var mergeRules = require('postcss-merge-rules');

var css = 'a{color:blue}a{font-weight:bold}';
console.log(postcss(mergeRules()).process(css).css);

// => 'a{color:blue;font-weight:bold}'

This module will attempt to merge adjacent CSS rules:

By declarations

a {
    color: blue;
    font-weight: bold
}

p {
    color: blue;
    font-weight: bold
}

Becomes:

a,p {
    color: blue;
    font-weight: bold
}

By selectors

a {
    color: blue
}

a {
    font-weight: bold
}

Becomes:

a {
    color: blue;
    font-weight: bold
}

By partial declarations

a {
    font-weight: bold
}

p {
    color: blue;
    font-weight: bold
}

Becomes:

a,p {
    font-weight: bold
}

p {
    color: blue
}

Contributing

Pull requests are welcome. If you add functionality, then please add unit tests to cover it.

License

MIT © Ben Briggs

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
7.0.5415,653latest
5.0.0-rc.2235next
4.0.0-nightly.2020.2.611nightly

Version History

VersionDownloads (Last 7 Days)Published
7.0.5415,653
7.0.41,233,703
7.0.329,793
7.0.2120,293
7.0.17,299
7.0.051,814
6.1.11,815,552
6.1.021,644
6.0.417,275
6.0.3117,337
6.0.222,089
6.0.1288,516
6.0.013,540
5.1.43,950,607
5.1.3464,587
5.1.2544,978
5.1.1138,631
5.1.032,835
5.0.629,014
5.0.547,916
5.0.441,620
5.0.363,038
5.0.2149,662
5.0.14,815
5.0.014,005
5.0.0-rc.2235
5.0.0-rc.12
5.0.0-rc.02
4.0.0-nightly.2020.2.611
4.0.0-nightly.2020.1.110
4.0.0-nightly.2020.1.91
4.0.0-nightly.2020.10.202
4.0.0-nightly.2020.9.965
4.0.0-nightly.2020.9.30
4.0.0-nightly.2020.9.12
4.0.0-nightly.2020.8.291
4.0.0-nightly.2020.8.250
4.0.0-nightly.2020.8.242
4.0.0-nightly.2020.8.170
4.0.0-nightly.2020.8.102
4.0.0-nightly.2020.8.41
4.0.0-nightly.2020.8.11
4.0.0-nightly.2020.7.311
4.0.0-nightly.2020.7.250
4.0.0-nightly.2020.7.241
4.0.32,236,526
4.0.220,398
4.0.11,770
4.0.037
4.0.0-rc.225
4.0.0-rc.00
2.1.2389,483
2.1.11,246
2.1.00
2.0.11281
2.0.10517
2.0.94
2.0.82
2.0.77
2.0.66
2.0.514
2.0.40
2.0.37
2.0.224
2.0.12
2.0.03
1.3.64,375
1.3.50
1.3.40
1.3.31
1.3.20
1.3.12
1.3.00
1.2.20
1.2.10
1.2.00
1.1.10
1.1.00
1.0.00

Package Sidebar

Install

npm i postcss-merge-rules@1.2.2

Version

1.2.2

License

MIT

Last publish

Collaborators

  • beneb
  • trysound
  • ludovicofischer
  • ai
  • chriseppstein
  • andyjansson
  • evilebottnawi
  • cssnano-bot