Closed hgl closed 9 years ago
No test, no merge. I need to see what are the improvements here. This also need docs & a line in the CHANGELOG too please.
I was going to add unit tests. But what this does is to simply throw an error. And none of the unit tests test thrown error. So not sure how to test it.
For such code
:root {
--color: var(--bg-color);
--bg-color: var(--color)
}
body {
color: var(--bg-color);
}
It throws:
self-referential variable: --bg-color
Manually tested.
Once you think the commit is good, I will add doc and changelog.
This commit does two things:
Both don't affect normal usage. Not sure if I should mention them in doc.
Please add a test using https://github.com/substack/tape#tthrowsfn-expected-msg Example here https://github.com/MoOx/reduce-css-calc/blob/master/test/index.js
Done.
Just found out this.
If there is a cycle in the dependency graph, all the custom properties in the cycle must compute to their initial value (which is a guaranteed-invalid value)
The initial value of a custom property is an empty value
Probably shouldn't throw an error?
Just a warning. See postcss 4.1 api.
I end up using console.warn
as you did for undefined variables.
Fix the things I mentioned in the gist.