DEV Community

Discussion on: CSS and JS Are at War, Here’s How to Stop It

Collapse
 
josef profile image
Josef Aidt

Interesting take on the topic! Personally I lean towards the JS-JS-JS side of things as I enjoy the sheer amount of tooling and enhancements that have been brought over to JavaScript, but I was on the vanilla side years ago just like everyone else. Although I wouldn't consider myself a CSS guru, I'm good enough to get a responsive layout going, and I find with styled-components in React this is much easier to manage (w/ effective code splitting) and modularize instead of a vanilla stack.

I will say that while I agree with many of the points you made, I saw a similar post labeling the other side of the frontend spectrum (the HTML-CSS-JS side) as claiming accessibility and design as their core focus rather than performance, which I think I agree with more. I would also bundle semantic markup into this as well as I know I do not consider this a first-class citizen when writing components for the first time.

Overall I think it's negligent to say either is more effective/efficient than the other since both sides present valuable aspects to building modern web applications. I'll list out a few of my thoughts on what is easier to implement (and maintain) on both sides:

HTML-CSS-JS:

  • accessibility
  • conceptualizing cascading styles
  • low-level animations

JS-JS-JS:

  • modularization of components (this is my favorite one; no need to copy lines of markup, ensure you have them placed correctly, and ensure you have the right classes for the intended effect — yay props)
  • traverse markup and generate markup (any time I can use Array.map() to generate content rather than hardcoding the markup, I'm happy)
  • w/ the right build tools: code splitting and tree shaking