Skip to content

Commit 39aa817

Browse files
FreekHeijtingclaude
andcommitted
feat(phase-2): deep research tailwind (vooronderzoek + sources + 6 lessons)
- 5668-word vooronderzoek covering v3.4 + v4 across all 16 scope areas - 30 sources WebFetched + verified (Tailwind docs, GitHub issues, plugin repos) - 6 lessons learned (L-001 .. L-006): v4 directive removal, @reference scoped trap, removed corePlugins/safelist/separator, variant stacking order flip, default visual changes, dynamic-class anti-pattern with v4 @source inline() fix - 9 newly discovered sub-topics: @reference, functional CSS funcs, @source inline, 3D transforms, expanded gradients, @starting-style, inset-shadow/ring, modern utilities (field-sizing/color-scheme/font-stretch), @theme inline/static Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 79999ad commit 39aa817

3 files changed

Lines changed: 758 additions & 15 deletions

File tree

LESSONS.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,38 @@ Observations and findings captured during skill package development.
44

55
---
66

7-
(Lessons will be added as L-XXX entries during development)
7+
## L-001 : v4 removes the three @tailwind directives entirely
8+
9+
The familiar v3 boilerplate of `@tailwind base; @tailwind components; @tailwind utilities;` is **gone** in v4. A single `@import "tailwindcss";` replaces all three. This impacts every install skill (`impl-build-*`) and the v3-to-v4 migration skill : every example must be split into a v3 column and a v4 column, never a single shared snippet.
10+
11+
Source : https://tailwindcss.com/blog/tailwindcss-v4 and https://tailwindcss.com/docs/upgrade-guide
12+
13+
## L-002 : `@apply` silently breaks in Vue/Svelte/CSS-modules `<style>` blocks in v4
14+
15+
When v4 compiles a scoped stylesheet in isolation (Vue SFC `<style>`, Svelte component `<style>`, CSS modules), the theme context is **not implicitly available**. `@apply text-2xl` fails with "Cannot apply unknown utility class". The v4-only fix is `@reference "../app.css";` (or `@reference "tailwindcss";`) as the first line of the scoped block. This is a brand-new directive with no v3 equivalent, and it MUST be documented prominently in any `impl-build-vue`, `impl-build-svelte`, or `impl-apply-directive` skill.
16+
17+
Source : https://tailwindcss.com/docs/functions-and-directives and https://github.com/tailwindlabs/tailwindcss/issues/16346
18+
19+
## L-003 : v4 removes `corePlugins`, `safelist`, and `separator` config options outright
20+
21+
These three v3 config options are simply gone in v4 (silently ignored if present in a `@config "./tailwind.config.js"` file). `safelist` has a CSS-native replacement (`@source inline("classnames")` with brace expansion). `corePlugins` and `separator` have NO replacement at all. The `errors-v4-migration` skill must explicitly warn users that disabling specific utilities (a common v3 customisation) is no longer supported : the closest workaround is `@source not "path"` to scope content scanning.
22+
23+
Source : https://tailwindcss.com/docs/upgrade-guide
24+
25+
## L-004 : v4 changes variant stacking order from right-to-left to left-to-right
26+
27+
A v3 selector like `first:*:pt-0` (read right-to-left : direct children, first one) compiles in v4 to `*:first:pt-0` (read left-to-right). This is a silent behavioural change : the upgrade tool catches common cases but bespoke arbitrary-variant stacks (e.g. `[&>div]:hover:bg-red-500` patterns combined with structural selectors) need manual review. Document this loudly in `syntax-variants` and `errors-v4-migration`.
28+
29+
Source : https://tailwindcss.com/docs/upgrade-guide section 14
30+
31+
## L-005 : Default border colour changed from `gray-200` to `currentColor`, and ring width changed from 3px to 1px
32+
33+
Two of the most invasive v4 visual breakages affect *every* existing project. The fix is either explicit colour utilities on every bordered/ringed element, OR a one-time `@layer base` shim that restores the v3 defaults. The migration skill should ship both options : the shim for quick visual parity, the explicit-utility approach for clean long-term code. The same applies to `shadow`, `blur`, `rounded`, `drop-shadow`, and `backdrop-blur` scale renames where everything shifted by one size step (`shadow-sm` is now smaller than v3's `shadow-sm` because `shadow-xs` was inserted below it).
34+
35+
Source : https://tailwindcss.com/docs/upgrade-guide sections 5 and 6
36+
37+
## L-006 : Dynamic class names from server-side data is the single most common anti-pattern, with a v4-specific safelist solution
38+
39+
The "I built a `bg-${color}-500` template helper and now nothing works in production" pattern is the most reported issue in the Tailwind tracker (issue 18136 is the canonical v4 instance, and the same class of problem dominates v3 issues too). The v4-specific solution `@source inline("{hover:,}bg-{red,blue,green}-{50,{100..900..100},950}")` is powerful but undocumented in most secondary sources. Every `errors-purge-issues` and `errors-build-failures` skill MUST cover : (a) why detection fails (plain-text token scan), (b) the static-map fix (preferred), (c) the inline-style fallback for truly runtime values, and (d) the `@source inline()` safelist with brace expansion as the v4 escape hatch. The v3 equivalent is the `safelist: [...]` config option, which is removed in v4.
40+
41+
Source : https://github.com/tailwindlabs/tailwindcss/issues/18136 and https://tailwindcss.com/docs/detecting-classes-in-source-files

SOURCES.md

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,51 @@ All skill content MUST be verified against these approved sources. No unverified
88

99
| Source | URL | Type | Last Verified |
1010
|--------|-----|------|---------------|
11-
| Tailwind CSS Official Docs (v3.4) | https://v3.tailwindcss.com/docs/installation | Official Documentation | Pending |
11+
| Tailwind CSS Official Docs (v3.4) | https://v3.tailwindcss.com/docs/installation | Official Documentation | 2026-05-19 |
1212
| Tailwind CSS Official Docs (v4) | https://tailwindcss.com/docs/installation | Official Documentation | Pending |
13+
| Tailwind CSS v4 Vite install | https://tailwindcss.com/docs/installation/using-vite | Official Documentation | 2026-05-19 |
14+
| Tailwind CSS v4 Next.js install | https://tailwindcss.com/docs/installation/framework-guides/nextjs | Official Documentation | 2026-05-19 |
15+
| Tailwind CSS v4 functions and directives | https://tailwindcss.com/docs/functions-and-directives | Official Documentation | 2026-05-19 |
16+
| Tailwind CSS v4 theme variables | https://tailwindcss.com/docs/theme | Official Documentation | 2026-05-19 |
17+
| Tailwind CSS v4 colors | https://tailwindcss.com/docs/colors | Official Documentation | 2026-05-19 |
18+
| Tailwind CSS v4 padding/spacing | https://tailwindcss.com/docs/padding | Official Documentation | 2026-05-19 |
19+
| Tailwind CSS v4 dark mode | https://tailwindcss.com/docs/dark-mode | Official Documentation | 2026-05-19 |
20+
| Tailwind CSS v4 responsive design | https://tailwindcss.com/docs/responsive-design | Official Documentation | 2026-05-19 |
21+
| Tailwind CSS v4 source detection | https://tailwindcss.com/docs/detecting-classes-in-source-files | Official Documentation | 2026-05-19 |
22+
| Tailwind CSS v4 utility-first philosophy | https://tailwindcss.com/docs/utility-first | Official Documentation | 2026-05-19 |
23+
| Tailwind CSS v4 styling with utility classes | https://tailwindcss.com/docs/styling-with-utility-classes | Official Documentation | 2026-05-19 |
24+
| Tailwind CSS v4 adding custom styles | https://tailwindcss.com/docs/adding-custom-styles | Official Documentation | 2026-05-19 |
25+
| Tailwind CSS v3 configuration | https://v3.tailwindcss.com/docs/configuration | Official Documentation | 2026-05-19 |
26+
| Tailwind CSS v3 plugin API | https://v3.tailwindcss.com/docs/plugins | Official Documentation | 2026-05-19 |
27+
| Tailwind CSS v3 dark mode | https://v3.tailwindcss.com/docs/dark-mode | Official Documentation | 2026-05-19 |
28+
| Tailwind CSS v3 variants | https://v3.tailwindcss.com/docs/hover-focus-and-other-states | Official Documentation | 2026-05-19 |
1329
| Tailwind CSS GitHub Repo | https://github.com/tailwindlabs/tailwindcss | Source Code | Pending |
1430
| Tailwind CSS Releases | https://github.com/tailwindlabs/tailwindcss/releases | Release Notes | Pending |
15-
| Tailwind CSS Blog (v4 launch) | https://tailwindcss.com/blog/tailwindcss-v4 | Official Blog | Pending |
31+
| Tailwind CSS Blog (v4 launch) | https://tailwindcss.com/blog/tailwindcss-v4 | Official Blog | 2026-05-19 |
32+
| Tailwind CSS Blog (JIT origin) | https://tailwindcss.com/blog/just-in-time-the-next-generation-of-tailwind-css | Official Blog | 2026-05-19 |
1633
| Tailwind CSS Blog Index | https://tailwindcss.com/blog | Official Blog | Pending |
17-
| Tailwind Plugins : Typography | https://github.com/tailwindlabs/tailwindcss-typography | Official Plugin | Pending |
18-
| Tailwind Plugins : Forms | https://github.com/tailwindlabs/tailwindcss-forms | Official Plugin | Pending |
19-
| Tailwind Plugins : Container Queries | https://github.com/tailwindlabs/tailwindcss-container-queries | Official Plugin | Pending |
34+
| Tailwind Plugins : Typography | https://github.com/tailwindlabs/tailwindcss-typography | Official Plugin | 2026-05-19 |
35+
| Tailwind Plugins : Forms | https://github.com/tailwindlabs/tailwindcss-forms | Official Plugin | 2026-05-19 |
36+
| Tailwind Plugins : Container Queries | https://github.com/tailwindlabs/tailwindcss-container-queries | Official Plugin | 2026-05-19 |
2037
| Tailwind Plugins : Aspect Ratio | https://github.com/tailwindlabs/tailwindcss-aspect-ratio | Official Plugin | Pending |
21-
| Tailwind CSS v4 Upgrade Guide | https://tailwindcss.com/docs/upgrade-guide | Migration Guide | Pending |
38+
| Tailwind CSS v4 Upgrade Guide | https://tailwindcss.com/docs/upgrade-guide | Migration Guide | 2026-05-19 |
2239
| Tailwind CSS v4 Vite Plugin | https://github.com/tailwindlabs/tailwindcss/tree/main/packages/%40tailwindcss-vite | Source Code | Pending |
2340
| Tailwind CSS v4 PostCSS Plugin | https://github.com/tailwindlabs/tailwindcss/tree/main/packages/%40tailwindcss-postcss | Source Code | Pending |
24-
| tailwind-merge | https://github.com/dcastil/tailwind-merge | Companion Library | Pending |
41+
| tailwind-merge | https://github.com/dcastil/tailwind-merge | Companion Library | 2026-05-19 |
2542

2643
### Secondary Sources (use only when primary is insufficient)
2744

2845
| Source | URL | Type | Last Verified |
2946
|--------|-----|------|---------------|
3047
| Tailwind UI Docs | https://tailwindcss.com/plus | Reference Patterns | Pending |
3148
| Tailwind Discord Issues (via GitHub Discussions) | https://github.com/tailwindlabs/tailwindcss/discussions | Community Issues | Pending |
32-
| Tailwind CSS Issues (anti-pattern mining) | https://github.com/tailwindlabs/tailwindcss/issues | Issue Tracker | Pending |
49+
| Tailwind CSS Issues (anti-pattern mining) | https://github.com/tailwindlabs/tailwindcss/issues | Issue Tracker | 2026-05-19 |
50+
| Issue 18136 : dynamic class names not detected | https://github.com/tailwindlabs/tailwindcss/issues/18136 | Anti-pattern source | 2026-05-19 |
51+
| Issue 16346 : @apply broken in v4 without @reference | https://github.com/tailwindlabs/tailwindcss/issues/16346 | Anti-pattern source | 2026-05-19 |
52+
| Issue 16287 : Next.js catch-all glob escape | https://github.com/tailwindlabs/tailwindcss/issues/16287 | Anti-pattern source | 2026-05-19 |
53+
| Issue 16733 : v4.0.8 Astro regression | https://github.com/tailwindlabs/tailwindcss/issues/16733 | Anti-pattern source | 2026-05-19 |
54+
| Issue 19825 : Turbopack arbitrary value miss | https://github.com/tailwindlabs/tailwindcss/issues/19825 | Anti-pattern source | 2026-05-19 |
55+
| Issue 9401 : decimal class purge | https://github.com/tailwindlabs/tailwindcss/issues/9401 | Anti-pattern source | 2026-05-19 |
3356

3457
## Verification Rules
3558

0 commit comments

Comments
 (0)