React Nexus Style
Ultra-light utility to help writing CSS inside your JS React components declarations. It simply scans a list of React components class definitions (in JS) and translates them into an actual CSS string.
Inside the class definition you have access to the full power of JS, which means you won't ever need a CSS preprocessor again.
Best friends with gulp-react-nexus-style
.
NOTE: This package is included in the React Nexus Starterkit but is it NOT tied to the React Nexus framework in any way. It is perfectly fine to use it without using React Nexus.
Usage (without gulp)
Declare styles
in the statics
of your component class:
var MyComponent = React;
Then pass one or more class definition(s) to extractAllStyles
:
Assuming that readFontSizeFromConfig()
returns 10
, then this outputs the string:
/* @react-nexus-style MyComponent */