Fix polyfill in combination with unused CSS variable removal#17555
Merged
RobinMalfait merged 4 commits intomainfrom Apr 7, 2025
Merged
Fix polyfill in combination with unused CSS variable removal#17555RobinMalfait merged 4 commits intomainfrom
RobinMalfait merged 4 commits intomainfrom
Conversation
352e77f to
b93750a
Compare
philipp-spiess
commented
Apr 6, 2025
I believe we used to use `Extract<AstNode, { nodes: AstNode[] }>` to get
all the AstNodes with children. But now that we are also taking its
`'nodes'`, we can simplify this:
```diff
- Extract<AstNode, { nodes: AstNode[] }>['nodes']
- AstNode[]
```
RobinMalfait
approved these changes
Apr 7, 2025
|
@philipp-spiess, do we have any approximate date for shipping this change (v4.1.4)? Our codebase is affected by this bug resulting in a number of missing color variables, and so we can't migrate to Tailwind v4.1+ until it's rectified. Thanks in advance! |
Contributor
Author
|
@dmitrc hopefully today 🤞 |
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.
This PR fixes an issue we noticed while investigating #17553, where the unused CSS variable removal didn't work properly when the theme variable it tried to remove was modified by a polyfill rule.
The way the bookkeeping for the unused CSS variable worked was that it tired to find the declaration inside it's parent after the traversal. However, the
color-mix(…)polyfill has since then made changes to the declaration so it can't find it's position correctly anymore and will thus instead delete the last declaration of the node (this caused unrelated CSS variables to be eliminated while the ones withcolor-mix(…)were unexpectedly kept).To fix this, we decided to apply the polyfills after any eventual deletions. This also ensures that no
@supportsquery for the variables are created and simplifies the code a bit since all polyfills are now colocated.Test plan