Closed simono closed 8 years ago
@simono Thank you for the PR :grinning:
Can you add some tests that would have failed previously and are now fixed? This is to ensure we don't regress later on.
@MadLittleMods Thanks for the great plugin 😀
I've added two tests in my branch. They fail on master and pass on my branch.
1) postcss-css-variables missing variable declarations should work as function arguments:
AssertionError: expected 'div{background-color:color(#fff) alpha(.5)}' to equal 'div{backgroun
d-color:color(#fff alpha(.5))}'
+ expected - actual
-div{background-color:color(#fff) alpha(.5)}
+div{background-color:color(#fff alpha(.5))}
and
2) postcss-css-variables missing variable declarations should work with two consecutive vars:
AssertionError: expected 'div{border:solid) var(--color,red}' to equal 'div{border:solid red}'
+ expected - actual
-div{border:solid) var(--color,red}
+div{border:solid red}
Please don't merge right now. I'm investigating a regression my fix introduced.
div {
--foo-color: #fff;
background-color: var(--foo-color, rgb(1,1,1));
}
is broken and produces
div {
background-color: #fff);
}
Please add a test to cover this case, thanks for the update :)
I've added a test (variable-with-fallback-as-function
) which fails at the moment.
This issue can't be fixed with the current Regex. Something like balanced-match could be used. postcss-custom-properties uses it and works correctly.
Right now I won't have the time to fix this. Feel free to close this PR and keep the current implementation. Thanks!
Given
var(--me, 1) a()
the first group would have been--me
and the second group1) a(
which is wrong. With this fix the second group is correctly matched as1
.This should fix #23.