News for hackers. Stuff that matters.
Re:Fix CSS by writing it in JavaScript by jacobr on Tuesday November 25, 2014 @10:24AM (#8658049)
Nice project!

The Cascade in CSS can be a real maintenance nightmare, and people seem to have very different ideas on how to handle encapsulation and modularization.

After a while with React, I thought it would be nice to define all styles for a component in the same location (inside my Component JavaScript). Setting the `top` property of a popup in JavaScript, but `width` or whatever in a CSS file just feels weird.

There's been some discussion about making this easier in React[1], but also resistance, so while waiting I wrote my own little library[2] (not React-specific), but it's not as feature rich as JSS.

I think that the fact that many projects[3] like this are popping up is validating the idea.

  [1] https://github.com/reactjs/react-future/blob/master/04%20-%20Layout/04%20-%20Inline%20Styles.md
  [2] https://github.com/jacobrask/marcssist
  [3] https://github.com/js-next/react-style
      https://github.com/tenphi/jcss
      https://github.com/chenglou/RCSS
Re:Fix CSS by writing it in JavaScript by colinramsay on Tuesday November 25, 2014 @10:32AM (#8658086)
You can set top in CSS.
Re:Fix CSS by writing it in JavaScript by lhorie on Tuesday November 25, 2014 @10:41AM (#8658117)
He means "top" as in "top-relative-to-scroll-position-when-the-modal-is-taller-than-the-screen-in-IE8"
Re:Fix CSS by writing it in JavaScript by colinramsay on Tuesday November 25, 2014 @10:45AM (#8658133)
Ah, well you'd still need something more powerful for that kind of thing to work. A constraints engine for example:

http://gridstylesheets.org/

If you're going to go to the trouble of writing a CSS processor, you could at least add in some really interesting ideas.

Re:Fix CSS by writing it in JavaScript by talmand on Tuesday November 25, 2014 @11:14AM (#8658275)
Why is setting width of a popup in CSS weird?