Hacker News new | past | comments | ask | show | jobs | submit login

There's nothing expressly better about SCSS over CSS in JS that you have demonstrated.

CSS In JS is mostly using similar structure, but often the JS dom interface naming... so fontFamily instead of font-family. It's also far easier to introduce codified variant functions or variable injection in JS than it is in SCSS.

I'm not saying don't use SCSS if it fits your model better... I've been very happy using react-jss via material-ui ... I've extended the baseline theme and that gets used throughout the application with each component defining its' styles that get injected.

Sharing can be a little more awkward, but it's easy enough, just call the same style method(s), or extend the baseline theme that gets injected.

The only thing you mention that might be better with (S)CSS directly would be efficiency and even that's relative. You can absolutely do all the rest with CSS in JS.




There have been many philosophical (and practical) conversations over the years that have lead to the development of a rich and varied frontend development ecosystem.

If you're building a frontend system, you need to consider the overall (macro) view, as well as the detail oriented (micro) view.

It's very difficult to do this with CSS in JS because of the compromises that need to be made to work in this way.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: