Parse error with CSS custom properties with default values including a nested calc
See original GitHub issueThe following CSS:
div {
margin-right: calc(var(--b, calc(var(--c) * 1)));
}
Leads to the following parser error:
JisonParserError: Parse error on line 1:
var(--b, calc(var(--c)*1))
-------------------------^
Expecting end of input, "ADD", "SUB", "MUL", "DIV", got unexpected "RPAREN"
Looking at the Stack trace, here’s the chain of the last few operations leading to the issue:
at Parser.parseError (/node_modules/postcss-calc/dist/parser.js:1164:15)
at Parser.parse (/node_modules/postcss-calc/dist/parser.js:1680:30)
at /node_modules/postcss-calc/dist/lib/transform.js:30:30
Removing the last * 1
part removes the parser error.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:23 (2 by maintainers)
Top Results From Across the Web
Parse error with CSS custom properties with default values including ...
Parse error with CSS custom properties with default values including a nested calc.
Read more >Post CSS parse error on calc() of CSS variables with several ...
I'm running a Nuxt.JS project with Post CSS and get the following error while generating the project's static ...
Read more >Using CSS custom properties (variables) - MDN Web Docs
Custom properties are subject to the cascade and inherit their value from their parent. Basic usage. Declaring a custom property is done using...
Read more >A Complete Guide to Custom Properties | CSS-Tricks
Above, --spacing is the custom property with 1.2rem as the value and ... syntax, how it interacts with the cascade, and its initial...
Read more >CSS Custom Properties In The Cascade - Smashing Magazine
The nested p element has no color specified, so the results are determined by inheritance (the color of the direct parent) rather than...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As a workaround, disable
postcss-calc
inpackage.json
to passgatsby build
in my case.Will enable again once this bug fixed. Thanks!
Any example of this for removing postcss-calc from Gatsby build please? I can’t achieve this…
I tried to edit my
postcss.config.js
, unsuccessful.