Live data from Hacker News

Vanilla JavaScript support for Tailwind Plus

tailwindcss.com

131–140 of 202 posts

Re: Vanilla JavaScript support for Tailwind Plus

#131
post #105

Earlier quoted context omitted.

I believe it's regular old css. The :has() pseudo class. https://developer.mozilla.org/en-US/docs/Web/CSS/:has

It's not even :has, it's just how child selectors in CSS have always worked. // Not actually needed, here // for competition .group {} // Child selector .group:hover group\/hover\:bg-black { background-color: black; } // Which is essentially the same as .group:hover child { background-color: black; }

Isn’t it funny that in a thread about how Tailwind is bad and people should learn real css… people also think css selectors require JS?

Re: Vanilla JavaScript support for Tailwind Plus

#132
post #105

Earlier quoted context omitted.

It's not even :has, it's just how child selectors in CSS have always worked. // Not actually needed, here // for competition .group {} // Child selector .group:hover group\/hover\:bg-black { background-color: black; } // Which is essentially the same as .group:hover child { background-color: black; }

That doesn't affect the parent (.group) based on the child though.

Atleast in Tailwind that’s what it should do. You hover over card (.group) and some elements inside change.

Re: Vanilla JavaScript support for Tailwind Plus

#133
post #80

Earlier quoted context omitted.

Yes I agree - it's nice to be able to see exactly what's happening without needing to dive into a rats nest of fragile CSS cascades.

This is literally a rats nest of css cascades.

It is not. Utility all classes have basic specificity of 0-1-0. There is no cascade just order of classes that all have same specificity.

Re: Vanilla JavaScript support for Tailwind Plus

#135
post #105

Earlier quoted context omitted.

It's not even :has, it's just how child selectors in CSS have always worked. // Not actually needed, here // for competition .group {} // Child selector .group:hover group\/hover\:bg-black { background-color: black; } // Which is essentially the same as .group:hover child { background-color: black; }

Isn’t it funny that in a thread about how Tailwind is bad and people should learn real css… people also think css selectors require JS?

:has doesn't require JS, I think the previous poster was just confused about which selector `group` is equivalent to.

Re: Vanilla JavaScript support for Tailwind Plus

#136
post #105

Earlier quoted context omitted.

It's not even :has, it's just how child selectors in CSS have always worked. // Not actually needed, here // for competition .group {} // Child selector .group:hover group\/hover\:bg-black { background-color: black; } // Which is essentially the same as .group:hover child { background-color: black; }

That doesn't affect the parent (.group) based on the child though.

No, but `group` doesn't affect the parent in Tailwind. You put `group` in the parent to mark it, and then use the `group/...` syntax to apply different properties to the child, depending on the different states of the parent. This doesn't require `:has`.

I don't think Tailwind has a built-in `:has` tool, but I suspect it would be easy to add one as a custom class.

Re: Vanilla JavaScript support for Tailwind Plus

#137
post #21

Looks like it's done using standards-based web components[0]. The page says these components don't require any existing JavaScript framework; because web component support is built-in to the browser. Nice to see devs picking up web components. [0]: https://developer.mozilla.org/en-US/docs/Web/API/Web_compone...

12 years I’ve been saying this… 12, damn, years. React graduates look at me crazy. Angular devs say it’s not needed anyway. Svelte bros say get bent. I’m so happy that someone is paying attention. You don’t need a shadow dom, you don’t need rerendering of everything when a simple value changes. You simply need web components and scoped js/ts with vite or whatever rollup you use.

Can you point to any example projects or a todo list app that shows how modern web component can be utilized.

Re: Vanilla JavaScript support for Tailwind Plus

#139
post #119

Lovely. Verbosity aside, now on top of knowing CSS you need to learn another hierarchical system within class names.

Oh yeah, when I open a typical big project with Tailwind I always love to see some: Team Settings Manage your team permissions, invites, roles, and integrations here. Changes apply instantly across all team workspaces. Cancel Save Changes

Every purple-gradient or blue-gradient website.

Re: Vanilla JavaScript support for Tailwind Plus

#140

Lovely. Verbosity aside, now on top of knowing CSS you need to learn another hierarchical system within class names.

I just can't fathom how someone can look at this and think "yeahhhh thats some good clean code". How did tailwind get so popular? Learn plain CSS. It's really good now

This is objectively good clean code when you develop it.

Because most of those classes are per component.

If you have a single card component defined with these classes, and then repeat it 20 times on the page, then of course the output will look like a giant mess.

> How did tailwind get so popular?

- quick to understand and get started with

- much cleaner for components than the variety of CSS-in-JS libs

- (mostly) do not require fighting CSS with BEM-style atrocities

- come with nice default styles and colors that can be easily changed and extended

> Learn plain CSS. It's really good now

CSS is okay now. We only just got nesting and scoping

Post reply on HN