question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to get auto-prefixing with vanilla Emotion?

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Andaristcommented, Sep 30, 2019

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?

1reaction
clemmycommented, 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 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to disable prefixes in Emotion 11 in development?
I got an answer from the emotion developers. It's possible to disable all Stylis plugins – including the auto-prefixer – like this:
Read more >
Quick Introduction to Styling React Components with Emotion
It is hard to compose inline styles, nested selectors and media queries are not supported, there is no auto-prefixing, and no theming support....
Read more >
Goober: A lightweight CSS-in-JS solution - LogRocket Blog
There are some popular CSS-in-JS libraries like emotion and ... team behind goober has created a separate package to handle auto prefixing ......
Read more >
How to add vanilla Emotion server-side rendering to Gatsby
Like Emotion but don't want to use the React API? Want to use server-side rendering with Gatsby? Here are some simple steps to...
Read more >
How to Style Your React Components - Ben Honeywill
You just have to link to your CSS file in the head of your HTML page and ... but with vanilla CSS we...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found