A
A
aivazovski2019-10-04 13:52:35
css
aivazovski, 2019-10-04 13:52:35

How to make, at least partially, human-readable class names in Emotion?

Hello !
The project encountered CSS-IN-JS implemented using Emotion. Due to the auto-generated style names, when working, I experience great pain from the fact that I cannot select the style name in the browser and then find it in the code.
Actually the question is, is it possible to somehow add "names" for Emotion styles, so that at least part of the generated name is human-understandable?
If not, then share how you find the "piece" in the code that you see in the browser?
5d9725682a100476268949.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
aivazovski, 2019-10-07
@aivazovski

It turns out everything was simple.
You can add a special property to css: label. And this text will be added to the end of the generated name, and there is no need to do mapping for babel.
https://emotion.sh/docs/labels
5d9aca4903a5e790255038.png

M
Mikhail Osher, 2019-10-04
@miraage

google for help
https://github.com/emotion-js/emotion/issues/756
https://github.com/emotion-js/emotion/issues/452

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question