Hacker News new | ask | show | jobs
by klodolph 2287 days ago
Honestly I say the reason it’s sad is because of the idea that CSS promised something it couldn’t deliver. The sad part isn’t that people gave up on CSS, the sad part is that people believed it could work this way in the first place.

Writing CSS stylesheets by hand is like writing HTML pages by hand. It just doesn’t scale, and you run into a million tiny problems every time you change something in a medium size project. So for HTML we use templates and components. For CSS, we want the CSS for a component right next to the component itself in our VS Code window, so that actual humans have good insight into what styles will affect a particular component. The alternative—keeping the CSS separate—requires its own set of tooling to plug the holes, like all those fancy web developer tools built into browsers these days.

1 comments

I always thought the approach of returning XML from your web server and having it refer to an XSLT stylesheet made the most sense. Unfortunately, XSLT is a very verbose and clunky style language. If it had been a better language, I think it could have been a good solution.
I think component systems like React are the closest we have to achieving that dream. This is why Vue, React, Angular etc. all look something like writing your own tags and then implementing them in terms of, eventually, standard HTML tags.

You can even swap out the web browser front-end, to an extent. I know that some mobile apps are done this way.