CSS-in-JS? Not yet.
Most of libraries just create stylesheets for you. From pure CSS or pure JS code.
CSS-to-JS
This webpack loader actually converts CSS code into the JavaScript. Not just provide classNames, but wraps everything with client-side CSS-in-JS libraries.
Supported APIs
- Styled-Components
Example
Given css:
And JS
// h1 is styled.css// you can use h1 as mixinconst H1 = styleddiv`;`; // and P is the real styled-componentconst App = <P>I am Component!</P>
Thus allows you to write more modular code. And keep all CSS inside CSS.
mixins
Existing CSS libraries.
To manage existing libraries see *-mixins
Licence
MIT