styled-jsx-plugin-sass icon indicating copy to clipboard operation
styled-jsx-plugin-sass copied to clipboard

[Bug] Variables in calc() cannot be compiled

Open uncaught opened this issue 2 years ago • 3 comments

Steps To Reproduce

  1. Use a variable inside a calc() function

The current behavior

A compile error Error: Expected "(" or ".". is thrown:

image

The expected behavior

No compile error.


I have created a minimal test repository with two calc cases:

git clone [email protected]:uncaught/styled-jsx-sass-var-in-calc-issue.git
cd styled-jsx-sass-var-in-calc-issue/
npm install
npm start

These usages of variables in calc() work with node-sass and styled-jsx-plugin-sass.

uncaught avatar May 06 '22 07:05 uncaught

Did you find any solution/workaround for this?

tudorc07 avatar Jun 09 '22 19:06 tudorc07

No, unfortunately not. I had to downgrade back to node-sass and styled-jsx-plugin-sass.

uncaught avatar Jun 10 '22 05:06 uncaught

You can create a constant like this const styles = calc( 100vh - ${variable1} - ${variable2}) , in order to workaround this issue

tudorc07 avatar Jun 10 '22 11:06 tudorc07