-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parenthesis pair mangled when variables declared within a CSS function #62
Comments
Hey @cmauduit, I just tested this out and I am not getting the same results. Could another plugin be interfering here? I also added a test to the codebase to make sure this test case is covered, dfb5ec1 Input: .box-foo {
background-color: color(var(--some-color, white));
} Output: .box-foo {
background-color: color(white);
} |
@MadLittleMods I see this as well in the PostCSS Playground. I'm running Chrome 62 on Windows 7, in case that makes any difference. Screenshot attached. |
Thanks @kenbellows, it looks like the key is to actually have the variable defined which I assumed wasn't because OP had the output value as the fallback value. Input, :root {
--some-color: #f00;
}
.box-foo {
background-color: color(var(--some-color, white));
} Output: .box-foo {
background-color: color(#f00;
} |
Any update? |
@equinusocio No update, PR welcome |
Hello,
I try to transform a css file (material-components-web.css) that contains variables declared in differents ways.
Some of them are not replaced by the plugin. For example :
background-color: color(var(--mdc-theme-text-primary-on-primary, white));
gives :
background-color: color(white;
So it miss a ')' before ';'
I had a look to the code of the plugin and I think that I found a solution. In the file resolve-value.js, I modified the regex variable :
RE_VAR_FUNC = (/var\((--[^,\s]+?)(?:\s*,\s*(.+))?\)/)
to
RE_VAR_FUNC = (/var\((--[^,\s]+?)(?:\s*,\s*([^\)\(]+|(.+)))?\)/);
It seems to work. If it is ok for you, can you implement it in your future versions?
Thx
The text was updated successfully, but these errors were encountered: