martinandert / babel-plugin-css-in-js

A plugin for Babel v6 which transforms inline styles defined in JavaScript modules into class names so they become available to, e.g. the `className` prop of React elements. While transforming, the plugin processes all JavaScript style definitions found and bundles them up into a CSS file, ready to be requested from your web server.
MIT License
299 stars 11 forks source link

context would be nice to take in an entry point file to be require'd #2

Closed cly closed 8 years ago

cly commented 8 years ago

In react-inline it was possible to -t, --context <name=path> Add context item (require'd from path) as name and it was possible to define complex data structures in the required file etc but it appears this functionality has been removed here. With context defined in the .babelrc it's very inflexible. The use case I'm talking about is defining colors and using darken or lighten from color.js to define some more colors and then to use this in the style sheet definitions.

martinandert commented 8 years ago

@cly With v0.3.0 of the plugin, this functionality has been re-added.

Note that the same restriction as in https://github.com/martinandert/react-inline/issues/8 applies here. If you have an idea how this can be fixed, please let me know.

cly commented 8 years ago

Sweet it works! It's something to do with the babel --watch not picking up the change. Not sure how to fix it but I've in the meantime just manually run babel.