05998a609f526537dbc044d0a506594ccae65819a6ffa12a814298b8b593dedfb4aa269b9d0bc956b49b5d65f085b9bb3420bcf556d02ece45047571d0a540 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. > Merge CSS rules with PostCSS.
  3. ## Install
  4. With [npm](https://npmjs.org/package/postcss-merge-rules) do:
  5. ```
  6. npm install postcss-merge-rules --save
  7. ```
  8. ## Examples
  9. This module will attempt to merge *adjacent* CSS rules:
  10. ### By declarations
  11. #### Input
  12. ```css
  13. a {
  14. color: blue;
  15. font-weight: bold
  16. }
  17. p {
  18. color: blue;
  19. font-weight: bold
  20. }
  21. ```
  22. #### Output
  23. ```css
  24. a,p {
  25. color: blue;
  26. font-weight: bold
  27. }
  28. ```
  29. ### By selectors
  30. #### Input
  31. ```css
  32. a {
  33. color: blue
  34. }
  35. a {
  36. font-weight: bold
  37. }
  38. ```
  39. #### Output
  40. ```css
  41. a {
  42. color: blue;
  43. font-weight: bold
  44. }
  45. ```
  46. ### By partial declarations
  47. #### Input
  48. ```css
  49. a {
  50. font-weight: bold
  51. }
  52. p {
  53. color: blue;
  54. font-weight: bold
  55. }
  56. ```
  57. #### Output
  58. ```css
  59. a,p {
  60. font-weight: bold
  61. }
  62. p {
  63. color: blue
  64. }
  65. ```
  66. ## Usage
  67. See the [PostCSS documentation](https://github.com/postcss/postcss#usage) for
  68. examples for your environment.
  69. ## Contributing
  70. Pull requests are welcome. If you add functionality, then please add unit tests
  71. to cover it.
  72. ## License
  73. MIT © [Ben Briggs](http://beneb.info)
  74. [ci]: https://travis-ci.org/ben-eb/postcss-merge-rules
  75. [deps]: https://gemnasium.com/ben-eb/postcss-merge-rules
  76. [npm]: http://badge.fury.io/js/postcss-merge-rules
  77. [postcss]: https://github.com/postcss/postcss