DEV Community

Discussion on: Don't Trust the Cascade - Why I write CSS in JavaScript

Collapse
 
marklai1998 profile image
Mark Lai

I agree with your reason
But I don't think the solution is always js since it already handle a lot of responsibility, separate CSS with js has its benefits like bundle size, performance, code test etc.....

I personally use CSS module in my project
Which I think is the best of both world

Collapse
 
thepaulmcbride profile image
Paul McBride

Hi Mark,

I totally agree that generating a separate CSS bundle from JS is an easy performance win. Thankfully, with most CSS in JS tools this is easy enough to do.

I had a chance to use CSS modules this weekend and they're really great!