Live data from Hacker News

Tailwind CSS v4.0 Beta 1

tailwindcss.com

51–60 of 135 posts

Re: Tailwind CSS v4.0 Beta 1

#51

Read some of the Getting Started documentation, for fun. First step: > Installing with Vite What the hell is Vite? Oh, it seems to be something you need to install via npm. I cannot help but to ask - why do we require npm, or Vite, for something that looks like it should "help" with CSS? Why is the webdev such a shitshow, that seems to get ever deeper into its own weird rabbit hole?

Software is required to "help" with CSS. Only seems reasonable that you'd need to install said software. Installing the Tailwind package provides the Tailwind software. So when you build your website that uses the `block` class, that class actually exists somewhere - because you pulled it in with the installation via the package manager.

Surely we can agree that distributing shared libraries via a package manager is a good practice, no?

Re: Tailwind CSS v4.0 Beta 1

#52

Tailwind threads usually include comments and questions that are answered in the documentation, so here's some useful links for people that haven't used Tailwind before. A core part of Tailwind is that you reuse styles by using a templating system vs using custom CSS classes e.g. you have a button.html file that contains the styling for your buttons for reuse, so you don't have to keep repeating the same utility clas…

I see tailwind as a new form of CSS built for the component age. It’s not a framework or design system.

I see it as a way of granular styling, because there's no cascading. And IMO works great if you style each element (or component) individually.

But the moment you need to style real html and not some kind of component structure - you have to look for something else.

If I switch to "old man yelling at the sky" mode I would say that's an example of a nice concept (utility classes) taken way too far.

Re: Tailwind CSS v4.0 Beta 1

#53

Read some of the Getting Started documentation, for fun. First step: > Installing with Vite What the hell is Vite? Oh, it seems to be something you need to install via npm. I cannot help but to ask - why do we require npm, or Vite, for something that looks like it should "help" with CSS? Why is the webdev such a shitshow, that seems to get ever deeper into its own weird rabbit hole?

Software is required to "help" with CSS. Only seems reasonable that you'd need to install said software. Installing the Tailwind package provides the Tailwind software. So when you build your website that uses the `block` class, that class actually exists somewhere - because you pulled it in with the installation via the package manager. Surely we can agree that distributing shared libraries via a package manager is…

CSS is text. What's wrong with copying the required CSS stylesheets over and including (importing) them from your own stylesheets?

Surely we don't need a "package manager" and a "build chain" for this?

Then again, I'm a person that writes any web-related code (HTML, JS, CSS, etc.) by hand.

Where did we take the left-turn of not understanding how things work on the actual tech level? These tools hide all of the actually required steps to npm-infested bloat.

Re: Tailwind CSS v4.0 Beta 1

#54

Earlier quoted context omitted.

Software is required to "help" with CSS. Only seems reasonable that you'd need to install said software. Installing the Tailwind package provides the Tailwind software. So when you build your website that uses the `block` class, that class actually exists somewhere - because you pulled it in with the installation via the package manager. Surely we can agree that distributing shared libraries via a package manager is…

CSS is text. What's wrong with copying the required CSS stylesheets over and including (importing) them from your own stylesheets? Surely we don't need a "package manager" and a "build chain" for this? Then again, I'm a person that writes any web-related code (HTML, JS, CSS, etc.) by hand. Where did we take the left-turn of not understanding how things work on the actual tech level? These tools hide all of the actual…

x86 ASM is text but we don't build software by copying and pasting it. While the underlying thing we ship is CSS, that doesn't mean we can't add tooling layers to make it easier or more efficient. While it's totally allowed to write by hand, most frontend web developers I know are very comfortable with NPM, and indeed having dependencies consumed from a package manager is often preferred.

Re: Tailwind CSS v4.0 Beta 1

#55

I've never had as much fun doing front-end web stuff as I've had since I've picked up tailwind.

this is the honeymoon phase, wait until your package manager and transpiler is out of date, and your progressive web app framework is out of date, and your typescript version isnt compatible with the upgrade yet, and tailwinds isnt either or it is but none of the documentation is yet, but you have to upgrade because your CI/CD cant run your version of node anymore and now you have 100 flags across 5 configuration fil…

It’s a standalone executable.

Re: Tailwind CSS v4.0 Beta 1

#57

Earlier quoted context omitted.

I see tailwind as a new form of CSS built for the component age. It’s not a framework or design system.

I prefer scoped css, eg svelte or react with CSS modules. This allows one to closely pair the styles with the component, but still separate out the styling from the html (I cannot stand tailwind/inline syles)

My favourite way too and fwiw not mutually exclusive with Tailwind (in case anyone was wondering).

Re: Tailwind CSS v4.0 Beta 1

#58

Earlier quoted context omitted.

Software is required to "help" with CSS. Only seems reasonable that you'd need to install said software. Installing the Tailwind package provides the Tailwind software. So when you build your website that uses the `block` class, that class actually exists somewhere - because you pulled it in with the installation via the package manager. Surely we can agree that distributing shared libraries via a package manager is…

CSS is text. What's wrong with copying the required CSS stylesheets over and including (importing) them from your own stylesheets? Surely we don't need a "package manager" and a "build chain" for this? Then again, I'm a person that writes any web-related code (HTML, JS, CSS, etc.) by hand. Where did we take the left-turn of not understanding how things work on the actual tech level? These tools hide all of the actual…

The number of tailwind classes is so large now that copy/pasting the whole set into your project would mean a huge bundle size.

Part of that the tailwind package is doing is making sure that only the relevant tailwind classes are included.

Re: Tailwind CSS v4.0 Beta 1

#59

Read some of the Getting Started documentation, for fun. First step: > Installing with Vite What the hell is Vite? Oh, it seems to be something you need to install via npm. I cannot help but to ask - why do we require npm, or Vite, for something that looks like it should "help" with CSS? Why is the webdev such a shitshow, that seems to get ever deeper into its own weird rabbit hole?

Looks like you are not really familiar with how Tailwind works. And if you don't understand it of course Vite or a build step will look weird. But I suggest first getting familiar with the thing you are discussing to avoid adding misguided comments to the discussion that really don't add any value.

Re: Tailwind CSS v4.0 Beta 1

#60
post #6

They are switching from sRGB to OKLCH. First time I heard of OKLCH tbh. Anyone know if that is part of a wider adoption trend or is Tailwind pioneering here? Looking at the examples it does seem to offer some advantages; but was primarily surprised that they now use it as a default.

Oklch is a polar colour space corresponding to the rectangular Oklab, designed as a perceptual colour space, matching how people see things, rather than how display technology works.

There are three things to consider here:

1. Colour interpolation, as used in things like linear-gradient() and color-mix(). The default of sRGB is not particularly good; choosing Oklab or Oklch instead will normally improve things. Oklch is an okay default these days. I reckon that for most applications, Oklab is better. Oklch tends to be too vibrant in the most extreme cases like #ff0000 → #0000ff. Here’s a simple demo you can play with:

  data:text/html,div{width:20em;height:2em;display:flex;align-items:center;justify-content:center;background:linear-gradient(in var(--space) to right,var(--from),var(--to));}document.querySelectorAll("input").forEach(e=>e.onchange())sRGBOklabOklch
2. Specifying colours that are beyond the sRGB gamut. This is what they say in https://tailwindcss.com/docs/v4-beta#modernized-p3-color-pal...: “taking advantage of the wider gamut to make the colors more vivid in places where we were previously limited by the sRGB color space”. Frankly, this is seldom actually advisable. For most purposes, sRGB is quite enough, thank you: go beyond it, and your colours will be too vivid. In photographs it makes sense, but for colour palettes used with blocks of colours and such, it’s normally a bad idea. Yet if you are trying to go beyond sRGB, meh, nothing wrong with writing it in Oklch. Though color(display-p3 ‹r› ‹g› ‹b›) may be easier to reason about—

3. Specifying general colours. I’ll be blunt. Perceptual colour spaces are horrible at this. With things like HSL and LCH (and even display-p3 colours), you get values in a known range (e.g. 0–100%, 0–360°, 0–1), and they all work. With things like Oklch, do you know how thin the range of acceptable values is? Just try working with yellow, I dare you, or anywhere at the edges of what things are capable of. As a human, you cannot work with these values. You have to treat them as opaque, only to be manipulated by colour-space-aware tools. To take the most extreme example, take #ffff00, which https://oklch.com/ says is approximately oklch(0.968 0.21095439261133309 109.76923207652135)… whoops, you already slipped out into Rec2020 space. And it goes approximating it to #ffff01, anyway. And fairly minor adjustments will take it out of any current (or probable!) gamut. Just look at the diagrams, see how slim the area of legal values is at this extreme.

Perceptual colour spaces are really good for some things: interpolation, and some data visualisation palette things. But beyond that, you’re in a digital world, and a limited world at that, and they’re actually quite difficult to work with, and you should normally stick with #rrggbb. Especially if you have any interest in working near the maximum of any colour channel.

As an example, look at a place oklch() is used in that document:

  --color-avocado-100: oklch(0.99 0 0);
  --color-avocado-200: oklch(0.98 0.04 113.22);
  --color-avocado-300: oklch(0.94 0.11 115.03);
  --color-avocado-400: oklch(0.92 0.19 114.08);
  --color-avocado-500: oklch(0.84 0.18 117.33);
  --color-avocado-600: oklch(0.53 0.12 118.34);
I don’t know how they chose those numbers, but there’s no low-order polynomial curve there; they seem entirely arbitrary choices. Not a good showing for Oklch. The “modernized P3 color palette” shown is just as bad: all of L, C and H seem arbitrarily chosen. If you’re going to do it like that, you’re completely wasting your time putting the numbers in a perceptual colour space.

To be clear: Oklch is way better than RGB for some things, but it’s downright terrible for some purposes (often because you do actually care about the display technology, rather than a theoretical model of how vision works), and a lot of the claimed benefits for some purposes don’t hold up to real analysis.

Post reply on HN