MadLittleMods / postcss-css-variables

PostCSS plugin to transform CSS Custom Properties(CSS variables) syntax into a static representation
https://madlittlemods.github.io/postcss-css-variables/playground/
Other
536 stars 62 forks source link

Do not duplicate blocks of multiple comma separated selectors #110

Closed SuperPat45 closed 4 years ago

SuperPat45 commented 4 years ago

Input:

:root {
  --font-size: 12px;
  --font-family: roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
}
html,body {
  font-family: var(--font-family);
  font-size: var(--font-size);
}

Actual output:

:root {
  --font-size: 12px;
  --font-family: roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
}
html {
  font-family: roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-family: var(--font-family);
  font-size: 12px;
  font-size: var(--font-size);
}
body {
  font-family: roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-family: var(--font-family);
  font-size: 12px;
  font-size: var(--font-size);
}

Expected:

:root {
  --font-size: 12px;
  --font-family: roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
}
html,body {
  font-family: roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-family: var(--font-family);
  font-size: 12px;
  font-size: var(--font-size);
}
MadLittleMods commented 4 years ago

Duplicate of https://github.com/MadLittleMods/postcss-css-variables/issues/58

Related to https://github.com/MadLittleMods/postcss-css-variables/issues/67, https://github.com/MadLittleMods/postcss-css-variables/issues/105