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

babel-macro version? #8

Open
polarathene opened this issue Feb 7, 2019 · 1 comment
Open

babel-macro version? #8

polarathene opened this issue Feb 7, 2019 · 1 comment
Projects

Comments

@polarathene
Copy link

When building a project with create-react-app(CRA), styled-components offers importing it via styled-components/macro which will seamlessly integrate with CRA's babel config without having to do anything like eject config to add your own babel config and plugin for styled-components.

I've been doing so fine, but when I brought in this package, it wasn't happy as it's importing the non-babel-macro version.

@polarathene
Copy link
Author

@arcticicestudio I don't know if this is the right approach, but what about moving the css helper declaration into it's own file, wrapped in a function to inject the css helper as a parameter? Then index.js can just import that and call the function to get the result to return as currently done, and similar index.js can be done for those in need of babel-macro version, they'd just import it like styled-components:

import modernNormalize from "styled-modern-normalize/macro";

I think it's a clean way to go about it? The function could also include the version information and return that to avoid duplication... so you'd still really only being updating that one file if modern-normalize puts out a new release.

@arcticicestudio arcticicestudio added the Hacktobefest This repository participates in the Hacktoberfest label Oct 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Backlog
  
New
Development

No branches or pull requests

2 participants