News for hackers. Stuff that matters.
Re:Signals for Tailwind CSS (styling based on ancestor state... by aidos on Saturday August 31, 2024 @05:12PM (#41412024)
I disagree with the main motivations and benefit. For me it’s always been about being able to handle hover states etc without having to leave the local context where I’m working. I don’t think anyone can really write tailwind without understanding css.
Re:Signals for Tailwind CSS (styling based on ancestor state... by franga2000 on Saturday August 31, 2024 @05:37PM (#41412200)
Adobe Brackets had an interesting solution to the context switching problem. There was a keybind, I think CTRL+E, that would let you edit all the styles that apply to the current element in a kind of inline sub-editor. It was quite neat and I haven't seen it done in any other editor.
Re:Signals for Tailwind CSS (styling based on ancestor state... by krsdcbl on Saturday August 31, 2024 @07:48PM (#41412933)
if the styles only concern the context you work on, this could easily be done with vanilla scoped inline styles

If those declarations are relevant to multiple components within your codebase, then you'll still need to leave the context when your styles are inlined and therefore declared in multiple places

Re:Signals for Tailwind CSS (styling based on ancestor state... by aidos on Sunday September 01, 2024 @03:34AM (#41415022)
No. That’s the point of tailwind. You can include things like hover states. Inline css hits a roadblock there and you’re forced to go out to a style tag. Then you have to start naming things. Then you risk conflicts.

That’s the problem tailwind solves.

Re:Signals for Tailwind CSS (styling based on ancestor state... by spankalee on Saturday August 31, 2024 @05:44PM (#41412250)
You didn't have to leave the local context if you use very local stylesheets. Scoped CSS like shadow DOM, plus CSS text right with your component, helps a lot with this.
Re:Signals for Tailwind CSS (styling based on ancestor state... by wruza on Saturday August 31, 2024 @06:52PM (#41412646)
Style attribute lacks a selector (“color:red” vs. “.comp {color:red}”), forbidding the most useful use case. Shadow dom is an inspection nightmare used only by a few progressive web purists. Style.css is an untyped incoherent spaghetti. There’s no really good place for an element style in current implementation.
Re:Signals for Tailwind CSS (styling based on ancestor state... by krsdcbl on Saturday August 31, 2024 @07:50PM (#41412943)
op is not talking about style atts, but referring to nesting inline `<style> @scope { ... }</style>` to declare vanilla css in the scope & context of specific DOM nodes
Re:Signals for Tailwind CSS (styling based on ancestor state... by wruza on Sunday September 01, 2024 @03:52AM (#41415083)
Isn’t it a “limited availability” feature? Why would they use it?
Re:Signals for Tailwind CSS (styling based on ancestor state... by paulddraper on Sunday September 01, 2024 @07:54PM (#41421318)
Yeah, but `@scope` is only if you don't want to support Firefox.
Re:Signals for Tailwind CSS (styling based on ancestor state... by spankalee on Monday September 02, 2024 @03:08PM (#41427990)
No, in taking about the native scoping you get with shadow DOM, which is awesome and not an "inspection nightmare".