r/Frontend • • Mar 07 '19

Why I Write CSS in JavaScript

https://mxstbr.com/thoughts/css-in-js/
5 Upvotes

19 comments sorted by

View all comments

1

u/kowdermesiter Mar 07 '19

What's the killer feature that SASS doesn't have?

2

u/TheAesir 12 YOE Mar 07 '19

Among others

  • all the benefits of css modules

  • being able to write conditionals in JS

  • significantly easier to support multiple themes

1

u/kowdermesiter Mar 08 '19

All of these are supported by SASS.

1

u/TheAesir 12 YOE Mar 08 '19

Kind of, but not with the simplicity that you get with using JS to handle it. When the discussions at work came up initially about CSS in JS, they centered around theming. We support multiple brands, across our platform, and while it was possible to handle this using SASS modules, it wasn't clean a solution. There was also the issue of having to maintain JS constants files that matched the themes, in case we needed the values for whatever reason. Maintenance has been infinitely better since transitioning