News for hackers. Stuff that matters.
Re:Comparison of CSS in JavaScript Libraries for React by colinmegill on Monday July 13, 2015 @09:56PM (#9882393)
We've stopped shipping CSS on green fields client projects. It's been amazing. All of our styles are in JS objects that are applied to inline style tags. It's modularized like classes are, but there is no cascade so there are no globals. Most importantly, everything can be recomputed at any time - no longer dealing with a static stylesheet.

var globalStyles = require("globalStyles");

var styles = { color: globalStyles.blue, padding: foo ? "15px" : "10px", margin: bar(this.state.qux) }

We built Radium to solve the problems this causes, like :hover - it's the lib Chan talks about in that React Europe talk christopherscot links to.

http://projects.formidablelabs.com/radium/

I talked at CSSConf about ditching CSS for inline about a month ago:

https://www.youtube.com/watch?v=NoaxsCi13yQ

Re:Comparison of CSS in JavaScript Libraries for React by natmaster on Monday July 13, 2015 @04:49PM (#9880963)
Or just use webpack? Not sure what these things are trying to solve that making a less or scss file for every component file and require-ing it doesn't.
Re:Comparison of CSS in JavaScript Libraries for React by lstamour on Monday July 13, 2015 @06:04PM (#9881466)
There are a few arguments here on keeping your CSS in JS just as JSX allows for HTML in JS: https://speakerdeck.com/vjeux/react-css-in-js
Re:Comparison of CSS in JavaScript Libraries for React by christopherscot on Monday July 13, 2015 @06:44PM (#9881663)
Here's another talk that illustrates some of the emerging thoughts around inline styles in React https://www.youtube.com/watch?v=ERB1TJBn32c
Re:Comparison of CSS in JavaScript Libraries for React by supercoder on Tuesday July 14, 2015 @05:09AM (#9883626)
Great thing is this does away with the need for these macro languages like less and scss.
Re:Comparison of CSS in JavaScript Libraries for React by fuzionmonkey on Monday July 13, 2015 @08:07PM (#9882016)
If you're interested in CSS in JS you should check out css-modules [1] and its Webpack [2] or Browserify implementation [3].

You get scoped, modular, composable, requirable CSS without the burden of doing styles in JS.

[1] https://github.com/css-modules/css-modules

[2] https://github.com/webpack/css-loader

[3] https://github.com/css-modules/css-modulesify

Re:Comparison of CSS in JavaScript Libraries for React by SeeThruHead on Tuesday July 14, 2015 @04:06AM (#9883437)
This is miles better than everything on that list for things that don't need much dynamic style computation.
Re:Comparison of CSS in JavaScript Libraries for React by moretti on Tuesday July 14, 2015 @08:38AM (#9884369)
Here's another great comparison: https://github.com/MicheleBertoli/css-in-js

I think that css-modules (implemented in webpack's css-loader) is the sanest approach: https://medium.com/seek-ui-engineering/the-end-of-global-css...

Re:Comparison of CSS in JavaScript Libraries for React by PhrosTT on Monday July 13, 2015 @11:34PM (#9882732)
So I'm looking for a simple solution 1 step beyond just using js style objects. Would radium be good without creating a ton of lock-in? I can't really sort through this giant chart.