Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

[Bug] Variables in calc() cannot be compiled #135

Open
uncaught opened this issue May 6, 2022 · 3 comments
Open

[Bug] Variables in calc() cannot be compiled #135

uncaught opened this issue May 6, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@uncaught
Copy link

uncaught commented May 6, 2022

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 uncaught added the bug Something isn't working label May 6, 2022
@tudorc07
Copy link

tudorc07 commented Jun 9, 2022

Did you find any solution/workaround for this?

@uncaught
Copy link
Author

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

@tudorc07
Copy link

tudorc07 commented Jun 10, 2022

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants