Skip to content
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

CSS prop doesnt have access to the theme #285

Open
ivanbanov opened this issue Jun 28, 2021 · 5 comments
Open

CSS prop doesnt have access to the theme #285

ivanbanov opened this issue Jun 28, 2021 · 5 comments

Comments

@ivanbanov
Copy link
Contributor

ivanbanov commented Jun 28, 2021

Seems like the last css prop in the object does not work properly πŸ€·πŸ»β€β™‚οΈ

xxx

A small repo with the reproduction can be found here https://github.com/ivanbanov/xstyled-single-css-prop-bug

@ivanbanov
Copy link
Contributor Author

Actually I double checked and it seems to be happening with all the last cssprops in the style object

@ivanbanov
Copy link
Contributor Author

ivanbanov commented Jun 28, 2021

Ok one more update, it seems to be connected to the importMap configuration as well #286

I removed it and things started partially work, the styles are generated but inject in the wrong order. It might be related to this other issue #287

@ivanbanov ivanbanov changed the title Single css prop doesnt have access to the theme Css prop doesnt have access to the theme Jun 28, 2021
@ivanbanov ivanbanov changed the title Css prop doesnt have access to the theme CSS prop doesnt have access to the theme Jun 28, 2021
@agriffis
Copy link
Collaborator

I removed it and things started partially work, the styles are generated but inject in the wrong order

This was a misunderstanding of how styled wrappers work, as explained in #287 (now closed)

Actually I double checked and it seems to be happening with all the last cssprops in the style object

I agree, it only affects the last pair in the style object, and it's only broken with the macro.

Unfortunately I don't know anything about the macro (or very much about emotion since I don't use it). Perhaps you can debug more to figure out what needs to be fixed?

@agriffis
Copy link
Collaborator

Ok, this seems to fix the problem:

cssPropOptimization: false

in the babel plugin configuration, from here: https://github.com/emotion-js/emotion/tree/main/packages/babel-plugin#csspropoptimization

I don't really know what that does, it just seemed suspicious πŸ€·β€β™‚οΈ

Maybe it deserves a change in the upstream, maybe in xstyled, maybe just in documentation. Pull request would be welcome if you're able to figure it out.

However that doesn't fix #286

@ivanbanov
Copy link
Contributor Author

Unfortunately, it didn't seem to work for me, I will research a bit more to understand what is going on, I post it here if I find a solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants