-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Media query with calc in does not compile #5876
Comments
I think this unfortunately will involve updating the version of |
@Conduitry: it is still maintained (last npm update 2 months ago) |
I think https://github.com/thysultan/stylis might be a better fit, emotion and styled components in React use it for CSS in JS. A sophisticated parser like CSSTree seems a bit too much for the use inside the Svelte compiler (the AST is even being traversed as if it was JavaScript). |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
using as we do parse into the
upgrading css-tree to v2 alone will not fix this issue. |
A more standard way to get this bug would be using this media query: @media only screen and ((orientation: portrait) or (max-width: 600px)) |
I am seeking consensus from Svelte maintainers on the proposed solution below. So, this issue is valid and you can use single value CSS functions in media queries. See calc() expressions in the browser compatibility sections showing wide support. This includes not only The main problem is that I propose that when the So my proposal seeks to merge PR |
Great news folks... After the container query PR merge a couple of days ago I was able to refactor the You can find the PR here: #8430. |
… media query range syntax / MQ level 4 support. (#8430)
Description
When placing a calc inside of a media query you get a compiler error.
To Reproduce
This repl contains an example of the bug.
https://svelte.dev/repl/d3b8fb7d74d540b69b990f34105b9b22?version=3.31.2
This results in compiler error.
@media screen and (min-width: calc(100px - 10px)) { h1 { color: green; } }
Intended behavior
This works with normal css so it should produce valid css instead of throwing an error
System:
OS: Windows 10 10.0.18363
CPU: (16) x64 AMD Ryzen 7 2700X Eight-Core Processor
Memory: 7.15 GB / 15.94 GB
Binaries:
Node: 14.8.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.4 - ~\AppData\Roaming\npm\yarn.CMD
npm: 6.14.7 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 87.0.4280.141
Edge: Spartan (44.18362.449.0)
Internet Explorer: 11.0.18362.1
npmPackages:
rollup: ^2.3.4 => 2.36.1
svelte: ^3.31.2 => 3.31.2
The text was updated successfully, but these errors were encountered: