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

prototype - css-in-js (glam) #1

Closed
threepointone opened this issue Jul 7, 2017 · 10 comments
Closed

prototype - css-in-js (glam) #1

threepointone opened this issue Jul 7, 2017 · 10 comments
Assignees

Comments

@threepointone
Copy link

making this issue and assigning to myself, to make a prototype of glam that's compatible with this package, just to prove that it's possible.

the idea is to get this - facebook/create-react-app#2730 (comment) to "work".

@threepointone
Copy link
Author

oh, please assign this to me when you can :)

@threepointone
Copy link
Author

up for grabs, if anyone else wants to take a crack at it -

  • relay
  • preval (kent, I assume you'll try this one yourself?)

@EnoahNetzach
Copy link

Would this macro prototype also work for e.g. styled components?

If not, I'll be glad to contribute with a tailored one!

@threepointone
Copy link
Author

I'm just working on a small prototype to prove that it works, if you want something more full featured/matching the SC api, you're likely better off integrating with emotion https://github.com/tkh44/emotion since they already have much of the compliation work done

@EnoahNetzach
Copy link

EnoahNetzach commented Jul 7, 2017

Thank you for pointing me to emotion, but I wanted to try to prototype a SC macro to work with Create React App 😉.

@threepointone
Copy link
Author

threepointone commented Jul 7, 2017

styled-components already works in CRA (by nature of being a pure runtime lib), not sure what you'd use the macro for?

@threepointone
Copy link
Author

oh is it for this? https://github.com/styled-components/babel-plugin-styled-components go for it, could be useful

@EnoahNetzach
Copy link

yep!

kentcdodds pushed a commit to kentcdodds/babel-plugin-preval that referenced this issue Jul 7, 2017
This adds alpha support for
[babel-macros](https://github.com/kentcdodds/babel-macros)

ref: kentcdodds/babel-plugin-macros#1

Usage:

```javascript
import preval from 'babel-plugin-preval/macros'

const x = preval`module.exports = Math.random()`
```
@kentcdodds
Copy link
Owner

Done! You can now use preval without adding the preval plugin to your babel config. Simply add babel-macros to your plugins instead, then:

import preval from 'babel-plugin-preval/macros'

const x = preval`
  module.exports = Math.random()
`

And poof, it works. Can also do a function call or JSX :) Fun stuff.

@kentcdodds
Copy link
Owner

Gonna close this in favor of emotion-js/emotion#132

markmabery added a commit to markmabery/babel-plugin-preval that referenced this issue Mar 31, 2022
This adds alpha support for
[babel-macros](https://github.com/kentcdodds/babel-macros)

ref: kentcdodds/babel-plugin-macros#1

Usage:

```javascript
import preval from 'babel-plugin-preval/macros'

const x = preval`module.exports = Math.random()`
```
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