-
Notifications
You must be signed in to change notification settings - Fork 33
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
Parse error with CSS custom properties with default values including a nested calc #77
Comments
Thanks for issue, it is bug |
Looks like the same error for this:
|
Yes, right now i rewrite plugin and parser, i think release will be on end of week or next week |
As a workaround, disable "cssnano": {
"preset": [
"default",
{
"calc": false
}
]
} Will enable again once this bug fixed. Thanks! |
Btw I have the very same problem without having nested variables :
This breaks with error :
I assume having nested calc with no space between breaks it, since
works normally. |
@drinchev feel free to send a PR |
@evilebottnawi Actually my bug is unrelated to this one. Just checked and it seems to work with the latest master branch.
Both tests work on current Any plans to release soon? 7.0.1 is dependency of the current |
@drinchev thanks for investigate looks on this in near future |
@wessberg, Thanks for opening this issue. I was also struggling with same calc() issue inside CSS file |
I get a similar error when using css-loader's @value properties in calc functions. @value avatar-size: 36px;
.avatar {
width: avatar-size;
height: avatar-size;
margin-top: calc((avatar-size) / 2);
} Results in this error
The @value properties are processed by css-loader, which runs after postcss-loader. If nothing else, it seems appropriate for postcss-calc to just ignore calc values that fail to parse. |
I was able to work around my issue by including the postcss-modules-values plugin before postcss-calc. |
Any example of this for removing postcss-calc from Gatsby build please? I can't achieve this... I tried to edit my |
This bug happens because 'function' regexp not matching function which has many brackets inside: Line 13 in 6260789
As I understand it is not possible to match nested brackets by regex so it should be rewritten from regex. |
After transition from v7.0.0 to v7.0.[12], postcss-calc got a regression bug. Now I get the following error, though it has never been raised before: :root {
/* ... */
--main-gap-mobile: calc((100vw - var(--main-width-mobile)) / 2);
}
|
In my case it was caused by a third party library: sampotts/plyr#1816 |
It seems wrapping a variable inside |
As per Semigradsky's comment, I think it is something to do with when there are too many parenthesis levels in the formula:
|
Hm, looking at this issue, all these
|
|
You're right - although that first one still makes no sense: those |
In case this helps anyone, |
But does it just print an error message or does it crash? |
It fails and prints a generic error. Something like "failed at line 1 column 26." I don't have the error in front of me anymore. The error message was not accurate. I found the issue by removing and adding back styles until I narrowed it down to the culprit. |
The following CSS:
Leads to the following parser error:
Looking at the Stack trace, here's the chain of the last few operations leading to the issue:
Removing the last
* 1
part removes the parser error.The text was updated successfully, but these errors were encountered: