postcss / postcss-custom-properties

Use Custom Properties in CSS
https://postcss.github.io/postcss-custom-properties
MIT License
596 stars 77 forks source link

Do not replace when a CSS variable is declared as alias of an other variable #197

Closed SuperPat45 closed 4 years ago

SuperPat45 commented 4 years ago

I have declared a variable who is like an alias of another variable:

:root {
  --normal-text-color: #0c0c0c;
  --widget-text-color: var(--normal-text-color);
}

With preserve: true, it becomes:

:root {
  --normal-text-color: #0c0c0c;
  --widget-text-color: #0c0c0c;  /* This is useless! */ 
  --widget-text-color: var(--normal-text-color);
}

You should exclude replacement from the :root selector or if variable is declared with the assignment of another CSS Variable.

SuperPat45 commented 4 years ago

Sorry; NPM downloaded version 0.4.0 ...