News for hackers. Stuff that matters.
Re:Play with TailwindCSS in the Browser by ramesh31 on Friday June 10, 2022 @11:11AM (#31695279)
Cascading is excellent for websites. Terrible for applications. There's no concept of anything even remotely similar in any other UI technology. Native applications have use the "scoped component" paradigm for decades, and the web is finally catching up.
Re:Play with TailwindCSS in the Browser by deergomoo on Friday June 10, 2022 @03:19PM (#31698332)
This is the crux of it really. It makes a whole lot of sense to have cascading styles in documents. I don’t want to have to explicitly set a text colour for each individual paragraph.

But the opposite is largely true for UI elements. For one, I’m probably using some external templating or component framework to repeat them, because they mostly likely have behaviour attached and HTML by itself has no good story for that. For two, I pretty much never want their styling to be modified by the context in which they’re used.

Re:Play with TailwindCSS in the Browser by the_other on Saturday June 11, 2022 @06:31AM (#31703437)
> This is the crux of it really. It makes a whole lot of sense to have cascading styles in documents. I don’t want to have to explicitly set a text colour for each individual paragraph.

But that’s what you’re doing when you use scoped styles, components, Tailwind etc.

Just set it once, on body and forget about it for the lifetime of your app.

> I pretty much never want their styling to be modified by the context in which they’re used.

I guess we have worked on different projects. To me this sounds like the edge case. Most projects I’ve worked on want all the components/widgets/thingies in one consistent style that works together for a cohesive overall experience. For such situations (which to me feel like the majority case) the cascade is the simplest tool.

Re:Play with TailwindCSS in the Browser by 1shooner on Saturday June 11, 2022 @04:13PM (#31707889)
>Most projects I’ve worked on want all the components/widgets/thingies in one consistent style that works together for a cohesive overall experience. For such situations (which to me feel like the majority case) the cascade is the simplest tool.

This is the distinction to me. New methods in composing a page approach this differently: style consistency is maintained through dependencies and a build process rather than relying on context. To understand the styling I'm applying to a given HTML elemnt, I can look to the packages going into the build (just as a I do with other aspects of the code) rather than needing to understand every context my component could possibly be invoked within.