You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
1.1 KiB

4 years ago
  1. # [postcss][postcss]-merge-rules
  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. ## Contributors
  70. See [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).
  71. ## License
  72. MIT © [Ben Briggs](http://beneb.info)
  73. [postcss]: https://github.com/postcss/postcss