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

Add label property and autoLabel option for babel-plugin-emotion #375

Merged
merged 32 commits into from
Nov 4, 2017

Conversation

tkh44
Copy link
Member

@tkh44 tkh44 commented Oct 3, 2017

What:
This should help devs figure out where css code is written or the
component that it comes from. This should also open the doors for
name css property for devs to customize.

Checklist:

  • Documentation
  • Tests
  • Code complete

Kye Hohenberger added 2 commits October 3, 2017 12:53
This should help devs figure out where css code is written or the
component that it comes from. This should also open the doors for
`name` css property for devs to customize.
@codecov
Copy link

codecov bot commented Oct 4, 2017

Codecov Report

Merging #375 into master will increase coverage by 0.05%.
The diff coverage is 100%.

Impacted Files Coverage Δ
packages/babel-plugin-emotion/src/babel-utils.js 96.55% <100%> (+0.39%) ⬆️
packages/emotion/src/index.js 100% <100%> (ø) ⬆️
packages/babel-plugin-emotion/src/index.js 95% <100%> (+0.26%) ⬆️
packages/emotion-server/src/index.js 100% <100%> (ø) ⬆️
packages/react-emotion/src/index.js 100% <100%> (ø) ⬆️

const parent = path.findParent(p => p.isVariableDeclarator())
return parent && t.isIdentifier(parent.node.id) ? parent.node.id.name : ''
}

export function getIdentifierName(path, t) {
const classParent = path.findParent(p => t.isClass(p))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so we can include the name of the component the inline css call is in.

@tkh44 tkh44 requested a review from emmatown October 9, 2017 21:06
Copy link
Member

@emmatown emmatown left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm mostly cool with this but I'm wondering if we should add a label property instead, like glamor. It wouldn't be very hard to do, people would be able to add the labels manually if they wanted to and the labels could merge so you could see what the styles are composed from.

Copy link
Member

@emmatown emmatown left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think SSR will work with meta(we just have to change the regex and it'll work)

@tkh44
Copy link
Member Author

tkh44 commented Nov 3, 2017

@mitchellhamilton can you take a look at my updates. The emotion-server updates could use another look.

@emmatown emmatown changed the title Attempt to pass some metadata through to css function. Add label property and autoLabel option for babel-plugin-emotion Nov 4, 2017
@tkh44 tkh44 merged commit 4246cf5 into master Nov 4, 2017
@emmatown emmatown deleted the css-parse-meta-object branch December 8, 2017 03:01
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

Successfully merging this pull request may close these issues.

2 participants