>What is the alternative to CSS then? The alternative is inline styles. ... The idea is you apply styles to elements through JavaScript. But if you have a non-trivial app with thousands of elements across hundreds of pages, people will inevitably want to "tame", "organize", "consolidate", etc those inline styles into some coherent taxonomy to enforce consistency. Wherever and however the programmers decide to store t…
There's still some key differences between what this new JSON declared and Javascript distributed stylesheets would work. Mainly is that there is no more CSS Selector madness. You no longer need to have concepts such as selector specificity, nor the entire syntax around grabbing the correct selectors. Also you could then be able to logically follow the flow using traditional debugging methods rather than this mess wh…
The Debate Around “Do We Even Need CSS Anymore?”
51–60 of 67 posts
Re: The Debate Around “Do We Even Need CSS Anymore?”
#52In human history we always went through development loops. And I can tell you this: I was there when there was not much CSS, and certainly no preprocessors. CSS was the Next Big Thing on the table (not even 10 years ago, and div was the next big thing instead of table). There are reasons for CSS. Now that it's everywhere young people think it sucks. Because old code always sucks. But often it's not the technology tha…
In what universe did SQL ever go away? The growth of popularity of non-relational databases was a reflection of the emergence of a different applications and a different approach to development. The "hate" for SQL was indeed often misplaced, but the need for different kinds of databases was real. The schemas of SQL were powerful but sometimes cumbersome to developers who need to rapidly iterate on their applications.…
In the blogosphere - admittedly, a rather narrow 'universe'.
Re: The Debate Around “Do We Even Need CSS Anymore?”
#53Representing 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 plea…
Continues to be true if we replace "styles" with "documents".
Re: The Debate Around “Do We Even Need CSS Anymore?”
#54I'd propose the following distinction, especially for React users: If your components will only ever be used by you or a small, internal team of programmers, then inline styles can work. If, however, your components are meant to be re-usable, public and accessible then CSS is still a must. To pick on one project react-datagrid is a super useful, public component for displaying data, but they use inline styles, which…
Anyway, I got so frustrated with the state of things that I created a library aiming to provide a solid interface for third-party component authors: https://github.com/namuol/react-declarative-styles
(Still very early stages/not published on NPM)
And yeah, I stress the same points you just made about the problems of using inline styles with third-party components: https://github.com/namuol/react-declarative-styles/blob/mast...
Re: The Debate Around “Do We Even Need CSS Anymore?”
#55In human history we always went through development loops. And I can tell you this: I was there when there was not much CSS, and certainly no preprocessors. CSS was the Next Big Thing on the table (not even 10 years ago, and div was the next big thing instead of table). There are reasons for CSS. Now that it's everywhere young people think it sucks. Because old code always sucks. But often it's not the technology tha…
In what universe did SQL ever go away? The growth of popularity of non-relational databases was a reflection of the emergence of a different applications and a different approach to development. The "hate" for SQL was indeed often misplaced, but the need for different kinds of databases was real. The schemas of SQL were powerful but sometimes cumbersome to developers who need to rapidly iterate on their applications.…
In the same vein people will try different things and then come back to CSS and optimize the heck out of it. For example, if the global nature of CSS is a problem, maybe they simply add namespaces in CSS4 (I don't know CSS well enough to even make up a good example, sorry. But I hope it's still clear what I mean).
No matter how bad it is for what it's used, people will continue to use it and the smart, creative people who try to change it will end up optimizing it instead of replacing it.
Re: The Debate Around “Do We Even Need CSS Anymore?”
#56In human history we always went through development loops. And I can tell you this: I was there when there was not much CSS, and certainly no preprocessors. CSS was the Next Big Thing on the table (not even 10 years ago, and div was the next big thing instead of table). There are reasons for CSS. Now that it's everywhere young people think it sucks. Because old code always sucks. But often it's not the technology tha…
In what universe did SQL ever go away? The growth of popularity of non-relational databases was a reflection of the emergence of a different applications and a different approach to development. The "hate" for SQL was indeed often misplaced, but the need for different kinds of databases was real. The schemas of SQL were powerful but sometimes cumbersome to developers who need to rapidly iterate on their applications.…
A javascript framework can enforce a naming scheme. And then you can have your cake and eat it too.
Why wouldn't you WANT to have a naming convention for reusable components that are supposed to live on the page?
Re: The Debate Around “Do We Even Need CSS Anymore?”
#57I'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.
It's not actually that terrible, but then again it depends on what you're building I suppose. Where I work, I made a fairly robust image diffing utility that runs using Selenium/WebDriver on all browsers that we support. Combined with a robust test suite of many different scenarios, we can make changes to our stylesheets with a pretty high amount of confidence that if anything changed, it'll fail the build.
Re: The Debate Around “Do We Even Need CSS Anymore?”
#58Earlier quoted context omitted.
True. Doesn't address the userstylesheet problem though. Also, sending prerendered pages with inline styles causes a bandwidth problem. Your prerendered page is probably dynamic and uncacheable, but your stylesheet isnt. By using inline styles, you send tons of repetitive uncacheable styles over the network where you could have just used a stylesheet. If you need the power that a full general purpose programming lang…
If they're really that repetitive, then gzip should eliminate almost all of the bloat. We also need to think about number of round-trips. If you're on an old phone on a 3G connection in India, the extra round-trip from requesting the HTML then requesting the CSS makes a difference. I'm super interested about the performance aspect, too, but I feel like we need numbers to really go into detail. There's way too many fa…
If your stylesheets are properly versioned, they can be cached forever, which means exactly the same number of requests as inline styles with much less bandwidth use.
Re: The Debate Around “Do We Even Need CSS Anymore?”
#59Earlier quoted context omitted.
If they're really that repetitive, then gzip should eliminate almost all of the bloat. We also need to think about number of round-trips. If you're on an old phone on a 3G connection in India, the extra round-trip from requesting the HTML then requesting the CSS makes a difference. I'm super interested about the performance aspect, too, but I feel like we need numbers to really go into detail. There's way too many fa…
> We also need to think about number of round-trips. If you're on an old phone on a 3G connection in India, the extra round-trip from requesting the HTML then requesting the CSS makes a difference. If your stylesheets are properly versioned, they can be cached forever, which means exactly the same number of requests as inline styles with much less bandwidth use.
I agree that it's a special case, but it's one we shouldn't just ignore.
Re: The Debate Around “Do We Even Need CSS Anymore?”
#60Earlier quoted context omitted.
True. Doesn't address the userstylesheet problem though. Also, sending prerendered pages with inline styles causes a bandwidth problem. Your prerendered page is probably dynamic and uncacheable, but your stylesheet isnt. By using inline styles, you send tons of repetitive uncacheable styles over the network where you could have just used a stylesheet. If you need the power that a full general purpose programming lang…
If they're really that repetitive, then gzip should eliminate almost all of the bloat. We also need to think about number of round-trips. If you're on an old phone on a 3G connection in India, the extra round-trip from requesting the HTML then requesting the CSS makes a difference. I'm super interested about the performance aspect, too, but I feel like we need numbers to really go into detail. There's way too many fa…