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

How to get auto-prefixing with vanilla Emotion? #1523

Closed
clemmy opened this issue Sep 26, 2019 · 5 comments · Fixed by #1662
Closed

How to get auto-prefixing with vanilla Emotion? #1523

clemmy opened this issue Sep 26, 2019 · 5 comments · Fixed by #1662

Comments

@clemmy
Copy link
Contributor

clemmy commented Sep 26, 2019

Description:

I've re-read multiple times all the different areas of the documentation that refers to vanilla Emotion usage:

https://emotion.sh/docs/introduction#framework-agnostic
https://medium.com/@tkh44/emotion-ad1c45c6d28b
https://emotion.sh/docs/install
https://emotion.sh/docs/emotion

but I'm confused about what exactly Emotion is doing with the css-decorated template literals and how I can get them to be auto-prefixed. In my build pipeline, I have the autoprefixer plugin set up with PostCSS for the CSS loader, but from what I can see, Emotion does not omit any CSS.

I think it would be nice to:

  1. Describe the architecture about what emotion is doing on a high-level
  2. Walk through a solution for adding vendor prefixes with vanilla emotion
@Andarist
Copy link
Member

Hi! Nice to see you here (thanks for fragments 😉!).

Emotion is not using a "standard" autoprefixer (which works during build) - it ships with its own~ runtime parser ( https://github.com/thysultan/stylis.js ) which comes with autoprefixing and it's enabled for you by default.

@FezVrasta
Copy link
Member

This section of the documentation has some information:

https://emotion.sh/docs/@emotion/cache#prefix

@clemmy
Copy link
Contributor Author

clemmy commented Sep 27, 2019

Ah, thank you for the quick responses! So if I understand correctly, vanilla emotion should support auto-prefixing out of the box? :) We should totally be selling this feature!

My main misconception comes from: https://emotion.sh/docs/introduction#react where it says

CSS prop support - Similar to the style prop but adds support for nested selectors, media queries, and auto-prefixing.

Perhaps we should move the auto-prefixing support to the Framework Agnostic section 😄

@Andarist
Copy link
Member

Hm, it could be possibly mentioned better on that page - but it's not as simple as moving it to that section as it doesn't quite describe features of emotion, but rather when "bare" emotion can be used over @emotion/core (for React). Also, that quoted statement isn't incorrect - it doesn't describe differences from "bare" emotion but rather from "style" prop.

If you have any suggestions on how this could be improved, maybe you could prepare a PR that could help future readers?

@clemmy
Copy link
Contributor Author

clemmy commented Sep 30, 2019

I'll throw up a PR :)

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

Successfully merging a pull request may close this issue.

3 participants