Live data from Hacker News

The Debate Around “Do We Even Need CSS Anymore?”

css-tricks.com

1–10 of 67 posts

Re: The Debate Around “Do We Even Need CSS Anymore?”

#4
I've been using inline everything since templates (ejs) came into existence. Once you have templates you're only editing one location anyway.

The biggest problem with CSS is it's really easy to add, and close to impossible to delete (detecting potential repercussions is hard).

Sure there's performance issues, but most of the time your developer/maintenance time is worth the the extra bytes.

Re: The Debate Around “Do We Even Need CSS Anymore?”

#5

> The idea is you apply styles to elements through JavaScript. Great. Now simply reading a page without JS will become impossible, let alone interacting with it.

Two words. Reader mode. It strips all the cruft out and gives you the text with a sensible set of styles.

Re: The Debate Around “Do We Even Need CSS Anymore?”

#7
The separation of concerns argument is dogmatic here. Just because it used to be that you should keep presentation in your CSS and behavior in your javascript, doesn't mean that's a universal truth. It's a good abstraction to separate presentation from behavior, but that doesn't mean one has to be done in one language and the other in a different one. Separating the concerns just by partitioning them within your codebase is just as good for organization.

There are two real reasons to use CSS for your styles. One is that your page should work without javascript, and doing your styles in javascript is a completely stupid reason to break support for no-javascript environments. The other is user choice. If a user doesn't like something about how your page is presented, they can fix it using userstyles. Maybe some text is too small for them to comfortably read but when they zoom in the layout breaks or other text gets too big. It's hostile to break this standard feature of the web just for whatever silly gains you get from doing your styles in javascript.

Re: The Debate Around “Do We Even Need CSS Anymore?”

#8
CSS preprocessors are fine. Processors only understand binary but noone programs in binary today. If CSS become the binary of tomorrow, it's fine.

Inlining CSS is stupid, it makes your page bigger, less flexible, doesn't use browser caching technics, and didn't solve the problem at all (or make it worse...).

CSS with Javascript is even worse, as it will be slow as fuck, hard to maintain, and equivalent to directly write CSS by hand anyway.

flex-boxes, box-model, table display, and more... solve most of problems you will ever had.

Re: The Debate Around “Do We Even Need CSS Anymore?”

#9
Representing styles as executable code is a very poor idea. Suddenly you go from data you can inspect and play with to something you can just execute and take what you are given.

The principle of least power is an incredibly important axiom of the web's architecture, and when people break it, lots of things become more difficult or impossible. If you don't like CSS, then by all means, propose a replacement – but please don't propose replacing it with executable code.

See:

Rule of Least Power – https://en.wikipedia.org/wiki/Rule_of_least_power

Principle of Least Power – http://c2.com/cgi/wiki?PrincipleOfLeastPower

Re: The Debate Around “Do We Even Need CSS Anymore?”

#10
post #4

I've been using inline everything since templates (ejs) came into existence. Once you have templates you're only editing one location anyway. The biggest problem with CSS is it's really easy to add, and close to impossible to delete (detecting potential repercussions is hard). Sure there's performance issues, but most of the time your developer/maintenance time is worth the the extra bytes.

Sounds like an opportunity for IDE makers. Add plugins to track CSS/HTML/templating, "where used" tools, and refactoring to push frequently repeated styles up into a main CSS file, or rarely used styles down into the few elements using it.

Hopefully, there are few enough classes and styles injected from a long js code chain that you can manually check the things the IDE misses. JetBrains IDEs are surprisingly good at finding things connected via common libraries in code, so I'm hopeful that IDE makers could recognize common patterns in libraries such as React and Angular (e.g. - ng-class)

Post reply on HN