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

Does anyone miss descriptive class names? (applies not just to emotion) #452

Closed
spherop opened this issue Nov 9, 2017 · 5 comments
Closed

Comments

@spherop
Copy link

spherop commented Nov 9, 2017

So, I am loving react-emotion! We're going down the path of switching to it on my team after reviewing the options.

But.. the only downside compared to vanilla css for me is that the resultant css class attrs no longer map easily to what they are in code.

Eq:

...
ends up as...

I understand the need for the unique ID. Wondering if anyone else would derive value from retaining original component name in the ID, eg:

or just

This would save me a lot of mental effort looking through and understanding code in chrome console. Perhaps this is just me... curious anyone else's thoughts.

[Of course this adds some extra data in the file - could be optional.]

@evan-scott-zocdoc
Copy link

@spherop Try adding { autoLabel: true } to your babel-plugin-emotion config :)

@spherop
Copy link
Author

spherop commented Nov 10, 2017

Thanks for reply. This is great that this capability is there -- But I must be doing something wrong.
See anything wrong with my .babelrc? I'm still not seeing the labels added in css.

<div class="css-1nuurqv">...</div>

.babelrc

{ 
  "presets": ["react", "es2015", "stage-0"],
  "plugins": [
    ["emotion", {
      "autoLabel": true
    }],
    "transform-decorators-legacy"
  ],
  "env": {
    "development": {
      "presets": ["react-hmre"]
    }
  }
}

@evan-scott-zocdoc
Copy link

I don't believe so. I think it was a very recent addition though, so might need to upgrade your version of the babel plugin. #442 https://github.com/emotion-js/emotion/blob/master/CHANGELOG.md#rocket-enhancement

@spherop
Copy link
Author

spherop commented Nov 10, 2017

@evan-scott-zocdoc thanks so much - you were right - had to update. Now is working ...ahh such a relief to look in console at readable html hierarchy. Icing on the cake for me with react-emotion.

Thanks!

@tkh44
Copy link
Member

tkh44 commented Nov 10, 2017

Glad you got it worked out @spherop.

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

No branches or pull requests

3 participants