Make polyfill work when the theme variable resolves to another var#17562
Merged
RobinMalfait merged 2 commits intomainfrom Apr 7, 2025
Merged
Make polyfill work when the theme variable resolves to another var#17562RobinMalfait merged 2 commits intomainfrom
RobinMalfait merged 2 commits intomainfrom
Conversation
8508642 to 91f533b Compare RobinMalfait approved these changes Apr 7, 2025
saadeghi added a commit to saadeghi/daisyui that referenced this pull request Apr 7, 2025
…3758, closes: #3755 tailwindlabs/tailwindcss#17556 https://lightningcss.dev/playground/index.html#%7B%22minify%22%3Afalse%2C%22customMedia%22%3Atrue%2C%22cssModules%22%3Afalse%2C%22analyzeDependencies%22%3Afalse%2C%22targets%22%3A%7B%22chrome%22%3A6225920%7D%2C%22include%22%3A0%2C%22exclude%22%3A0%2C%22source%22%3A%22.broken%20%7B%5Cn%20%20%26%3A%3Abefore%2C%20%26%3A%3Aafter%20%7B%5Cn%20%20%20%20background%3A%20blue%3B%5Cn%20%20%20%20%40media%20print%20%7B%5Cn%20%20%20%20%20%20background%3A%20orange%3B%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%7D%5Cn%5Cn.fine%20%7B%5Cn%20%20%26%3A%3Abefore%2C%20%26%3A%3Aafter%20%7B%5Cn%20%20%20%20background%3A%20blue%3B%5Cn%20%20%7D%5Cn%7D%22%2C%22visitorEnabled%22%3Afalse%2C%22visitor%22%3A%22%7B%5Cn%20%20Color(color)%20%7B%5Cn%20%20%20%20if%20(color.type%20%3D%3D%3D%20'rgb')%20%7B%5Cn%20%20%20%20%20%20color.g%20%3D%200%3B%5Cn%20%20%20%20%20%20return%20color%3B%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%7D%22%2C%22unusedSymbols%22%3A%5B%5D%2C%22version%22%3A%22local%22%7D tailwindlabs/tailwindcss#17562
vaernion pushed a commit to Arbeidstilsynet/brevgen2 that referenced this pull request Dec 3, 2025
…patch) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@tailwindcss/postcss](https://tailwindcss.com) ([source](https://github.com/tailwindlabs/tailwindcss/tree/HEAD/packages/@tailwindcss-postcss)) | [`4.1.3` -> `4.1.4`](https://renovatebot.com/diffs/npm/@tailwindcss%2fpostcss/4.1.3/4.1.4) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [tailwindcss](https://tailwindcss.com) ([source](https://github.com/tailwindlabs/tailwindcss/tree/HEAD/packages/tailwindcss)) | [`4.1.3` -> `4.1.4`](https://renovatebot.com/diffs/npm/tailwindcss/4.1.3/4.1.4) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>tailwindlabs/tailwindcss (@​tailwindcss/postcss)</summary> ### [`v4.1.4`](https://github.com/tailwindlabs/tailwindcss/blob/HEAD/CHANGELOG.md#414---2025-04-14) [Compare Source](tailwindlabs/tailwindcss@v4.1.3...v4.1.4) ##### Added - Add experimental `@tailwindcss/oxide-wasm32-wasi` target for running Tailwind in browser environments like StackBlitz ([#​17558](tailwindlabs/tailwindcss#17558)) ##### Fixed - Ensure `color-mix(…)` polyfills do not cause used CSS variables to be removed ([#​17555](tailwindlabs/tailwindcss#17555)) - Ensure `color-mix(…)` polyfills create fallbacks for theme variables that reference other theme variables ([#​17562](tailwindlabs/tailwindcss#17562)) - Fix brace expansion in declining ranges like `{10..0..5}` and `{0..10..-5}` ([#​17591](tailwindlabs/tailwindcss#17591)) - Work around a Chrome rendering bug when using the `skew-*` utilities ([#​17627](tailwindlabs/tailwindcss#17627)) - Ensure container quer...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Discovered while triaging #17556
This PR improves the
color-mix(...)polyfill to ensure it works when a theme key links to another theme key via avar(...)call.Imagine this setup:
Since
--color-redwill link to--color-red-500which is also a known theme variable, we can inline the value of--color-red-500into the fallback now:This will allow for slightly less confusing behavior.
The code added also handles recursive definitions where a color is linking to another color that is again linking to the first one (by adding a
Setto keep track of already seen variable names).Test plan