arcticicestudio / styled-modern-normalize

modern-normalize.css for styled-components
http://npm.im/styled-modern-normalize
MIT License
18 stars 1 forks source link

babel-macro version? #8

Open polarathene opened 5 years ago

polarathene commented 5 years ago

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 commented 5 years ago

@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.