I
I
Ivan2021-06-11 14:56:48
css
Ivan, 2021-06-11 14:56:48

Is there such a PostCSS plugin that would take out common styles from selectors into a separate selector?

For example, there is the following code:

body {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex; }

p {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  font-size: 28px;
  background: violet;
  -webkit-box-shadow: 10px 10px black;
          box-shadow: 10px 10px black; }

ul {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  font-size: 28px;
  background: violet;
  text-decoration: none; }


Is there a plugin that would output the following:

body, p, ul {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex; }

p, ul { 
  font-size: 28px;
  background: violet;
}

p {
  -webkit-box-shadow: 10px 10px black;
          box-shadow: 10px 10px black; }

ul {
  text-decoration: none; }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question