News for hackers. Stuff that matters.
Re:Tailwind CSS v3.0 by tlamponi on Thursday December 09, 2021 @03:34PM (#29502560)
Sounds a bit like a glorified

    <el style="display:flex;justify-content: start;">...

?
Re:Tailwind CSS v3.0 by moritzwarhier on Thursday December 09, 2021 @03:42PM (#29502652)
The differences are:

* media queries

* @apply

* low specificity (tailwind doesn't do !important)

EDIT: It "does" important, but only when instructed so, in 1.x it was a global switch, apparently since 2.x its available as a per-class modifier. Thanks dcre

* the theming abstraction

* brevity

Re:Tailwind CSS v3.0 by dcre on Thursday December 09, 2021 @03:46PM (#29502694)
Tailwind does have important, it was added with JIT.

https://tailwindcss.com/docs/just-in-time-mode#built-in-impo...

Re:Tailwind CSS v3.0 by aidos on Thursday December 09, 2021 @03:50PM (#29502758)
Oh, nice, I think that’s a new 3.0 thing, not a JIT thing.
Re:Tailwind CSS v3.0 by dcre on Thursday December 09, 2021 @04:01PM (#29502874)
Looks like TW 2.2 from June. It wasn't in the initial JIT release in 2.1.

https://github.com/tailwindlabs/tailwindcss/releases/tag/v2....

Re:Tailwind CSS v3.0 by aidos on Thursday December 09, 2021 @04:08PM (#29502953)
I’m…not sure how I missed that, because I did look for it. Thanks for the heads up!
Re:Tailwind CSS v3.0 by nightpool on Thursday December 09, 2021 @04:02PM (#29502893)
In this scenario, "@apply" is just "a css class", so i don't think it's appropriate to list that as a benefit tailwind has over inline styles. In both cases you'd be defining the styles somewhere else.

Media queries are a good call out, they're definitely a benefit tailwind's approach has to the built-in browser support for inline styles. Another benefit is hover and focus states, which are very difficult to apply with inline styles.

Re:Tailwind CSS v3.0 by montroser on Thursday December 09, 2021 @06:29PM (#29504563)
Yes, or now with Tailwind v3.0 you can write that as

    <el class="[display: flex] [justify-content: start]">...
I wish I were being hyperbolic, but alas, no: https://tailwindcss.com/blog/tailwindcss-v3#arbitrary-proper...
Re:Tailwind CSS v3.0 by drusepth on Thursday December 09, 2021 @08:14PM (#29505316)
To be fair, one of the big perks of Tailwind (IMO) is not having to have a big ol' folder of CSS that you have to figure out what applies where in HTML, but rather just having all your styling inline (while still staying consistent, which is the usual downside of inlining styles manually). Having to have a tailwind-addons.css when you needed random bits of CSS they didn't have classes for kind of sucked; this looks like a nice QOL that would get me back to the original goal of uniting structure-and-style into singular files.

FWIW, I also hated using header files in C++ and also wrote a Ruby library for inlining all my tests immediately following the functions they test. I like having more context when looking at code without having to flip around from file to file to piece a bigger picture together.

Re:Tailwind CSS v3.0 by docmars on Thursday December 09, 2021 @09:54PM (#29505927)
The same reason Vue introduced single-file components!

If you haven't tried Vue yet, I strongly recommend it based on what you said.

Re:Tailwind CSS v3.0 by drusepth on Thursday December 09, 2021 @11:13PM (#29506310)
Thanks for the recommendation! I've mostly been thrust into React, which works for what I need but I definitely don't enjoy it. I'll give Vue a shot!
Re:Tailwind CSS v3.0 by akvadrako on Friday December 10, 2021 @04:14AM (#29507968)
Svelte also has single file components.

It seems the biggest advantage most people find in tailwind is working around a react limitation.

Re:Tailwind CSS v3.0 by docmars on Thursday December 09, 2021 @09:52PM (#29505911)
This seems silly, but even this has benefits over online styles: it generates a scoped classname that wouldn't interfere with others, and you can use this syntax with JS conditionals to dynamically apply CSS with values interpolated if you need.

Not much different than injecting an object in a `style` attribute in practice, but there's a lot of creative firepower in the arbitrary styles API.

Re:Tailwind CSS v3.0 by docmars on Sunday December 12, 2021 @10:05AM (#29530163)
Too late to edit, but not "online" styles—but "inline" xD
Re:Tailwind CSS v3.0 by keyle on Thursday December 09, 2021 @06:58PM (#29504820)
Excuse my dad joke "There is a lot of wind at the end of that tail"!
Re:Tailwind CSS v3.0 by Tade0 on Thursday December 09, 2021 @03:57PM (#29502833)
Re:Tailwind CSS v3.0 by dcre on Thursday December 09, 2021 @03:44PM (#29502680)
Absolutely. But that's not a downside, that's exactly what I want.
Re:Tailwind CSS v3.0 by nightpool on Thursday December 09, 2021 @03:50PM (#29502754)
Then why not just type that, instead of having to learn a completely separate set of concepts to map to the underlying CSS properties & values? I program with inline CSS styles all the time when I'm prototyping something or building a page quickly.
Re:Tailwind CSS v3.0 by aidos on Thursday December 09, 2021 @03:56PM (#29502818)
Because inline styles aren’t flexible enough to be used for everything, so you need to go out to external css eventually.

With tailwind you can do “block md:flex hover:font-bold” and you’ve covered pseudo class cases and media queries very succinctly.

Re:Tailwind CSS v3.0 by dcre on Thursday December 09, 2021 @04:22PM (#29503115)
It's much more concise than inline styles, variants and configuration give you a lot more power, and it's not a separate set of concepts. It's a subset of the same set of concepts.
Re:Tailwind CSS v3.0 by psygn on Thursday December 09, 2021 @03:58PM (#29502847)
Re:Tailwind CSS v3.0 by mixmastamyk on Thursday December 09, 2021 @04:49PM (#29503414)
It's like radio presets instead of the full dial. Dial is still available, but a great majority of the time you use the presets.