Closed29

Tailewind v4 にちゃんと目を通しておく

hajimismhajimism

既存のプロジェクトはCLIで移行した

新規だとViteかPostCSSで、入れ方が以前と変わっている

hajimismhajimism

ビルドが早くなった

The most impressive improvement is on incremental builds that don’t actually need to compile any new CSS — these builds are over 100x faster and complete in microseconds. And the longer you work on a project, the more of these builds you run into because you’re just using classes you’ve already used before, like flex, col-span-2, or font-bold.

嬉しい

hajimismhajimism

@layer が ネイティブのものに代わったらしい。

but native cascade layers can do things that we couldn’t easily replicate at build-time, like isolating styles within a layer even if they have a higher specificity than styles in another layer.

hajimismhajimism

自動検知と手動の@sourceで対象検知。
自動検知はどういうアルゴリズムでやってるんだろう。

hajimismhajimism

theme に無い値を設定するときに[]が要らなくなったらしい。これはどうだろう、テーマから外れた箇所に気づきづらくてイマイチな気がする。

In v4.0, we’ve really slimmed down the amount of theme configuration you need to do, especially for things that aren’t really design tokens.

hajimismhajimism

spacing は 単に 「0.25rem の何倍か」で計算されるようになったらしい?デザインシステムというよりはEasyなCSSとしてのツールに向かっているね

hajimismhajimism

まあもともと作者にはデザインシステム意識はほとんど無かった気がする

日本だとメタフレームワークとしての見方が強かったから、どうか

hajimismhajimism

デフォルトのカラーパレットが oklch に。
誰かいい加減こいつの発音を教えてくれ(頭の中ではオークリッチって読んでる)。

hajimismhajimism

container query のデフォルトサポート
しかも min/max構文なんてあるんだ、つよい

  <div class="flex @min-md:@max-xl:hidden">
hajimismhajimism

bg-gradient-* から bg-linear-* になって、角度が書けるようになった

<div class="bg-linear-45 from-indigo-500 via-purple-500 to-pink-500"></div>
hajimismhajimism

conic, radial グラデーションの追加。3d 関連と合わせて表現力が増した感じ。

hajimismhajimism

color-scheme 追加

Throw scheme-light dark:scheme-dark on your html or body element and your scrollbars will always look good, no matter which dark mode strategy you use.

hajimismhajimism

starting 追加。うれしい。

The new starting variant adds support for the new CSS @starting-style feature, making it possible to transition element properties when an element is first displayed:

hajimismhajimism

not 追加。こういうのもできるのか。

<div class="not-supports-[display:grid]:flex">
hajimismhajimism

nth, in も追加
すごい、不満がどんどん減ってく

hajimismhajimism

popover-open を open で対応した件、ウケる

I’m sure I’m eventually going to regret not making it a separate popover-open variant but I thought really hard about it and couldn’t think of any situations where an element would use both [open] and :popover-open and have different styles for each condition. Someone is going to update the spec and screw me on this one down the road though for sure.

hajimismhajimism

そもそも子要素適用できるのすら知らんかったけど

<ul class="*:p-4">
  <li>One</li>
  <li>Two</li>
  <li>Three</li>
</ul>

**で再帰的にいけるらしい

<div class="**:data-avatar:rounded-full">
hajimismhajimism

prefix が variant チックになったらしい

@import "tailwindcss" prefix(tw);
<div class="tw:flex tw:bg-red-500 tw:hover:bg-red-600">
hajimismhajimism

カスタム utility, カスタム variant はそれぞれ @utility @variant

hajimismhajimism

v3からの変更点も簡潔にまとめられてて助かる

v4 より素直に、より速く、そして表現力がより高くなった感じ。
[] の件だけ気になる。spacing もか。

このスクラップは2024/12/31にクローズされました