re: Rethinking CSS VIEW POST

FULL DISCUSSION
 

What don't you like about scoped css? Scoped css doesn't necessarily mean you are required to have a file per component, but even if that were required, is it a bad thing to have component css that matches the component driven development of modern libraries?

 

I usually use Vue.js so markup, JS and CSS are all in the same template file.

In fact, I like the concept of separation. In my opinion, components are more easily reusable if the design is not included. I mean this way I will be able to make a whole new and consistent design with the same markup and functionality. So even if I can add scoped CSS in Vue templates (and I do for very special CSS rules only), I use global CSS files, too.

But again, I like the concept, and it can be great, but my experience shows that this is something that works for us.

 

I can understand that, and I agree we are still figuring it out. In React, I find myself often separating my presentation components from my container components to start and that works 85% of the time. In those cases where I have a lot of styles (atoms), I will break that out into its own file.

I prefer CSSinJS because to me, there's less of a context switch and I haven't ran into a scenario where it didn't meet my needs.

Unfortunately, most of the tooling for this pattern doesn't support the shadow dom, so I find myself using Stencil when I create framework agnostic components.

code of conduct - report abuse