postcss / postcss-custom-properties

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

When `custom-property-name` same as `property-name` #61

Closed helloyou2012 closed 7 years ago

helloyou2012 commented 7 years ago

I want to override property like this:

:root {
  --main-color: #333;
  --main-color: var(--main-color, #666);
}
h1 {
  color: var(--main-color);
}

Current output is

h1 {
  color: #666;
}

But I expect

h1 {
  color: #333;
}
MoOx commented 7 years ago

You cannot "override" a property using itself. You are not in a programming language. It's how the spec works sorry. (Try in a browser that support custom props like Firefox or latest Chrome)

helloyou2012 commented 7 years ago

@MoOx thanks, but so pity. I have just leave a issue https://github.com/w3c/csswg-drafts/issues/876