-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor gradient implementation to work around prettier/prettier#17058…
… (#16072) This PR fixes an issue where tools like Prettier remove important trailing commas in CSS variables, making gradients invalid. We encoded the `,` in the `--tw-gradient-position` to ensure that _if_ the `var(--tw-gradient-position)` is used, that the `,` was there. And if the variable was _not_ used that we didn't end up with a double `,,` rendering the gradient invalid. However, when running Prettier (there might be other tools that do this as well), the trailing comma in the `--tw-gradient-position` was removed which made the entire gradient invalid. E.g.: ```diff .bg-gradient-to-r { - --tw-gradient-position: to right in oklab,; + --tw-gradient-position: to right in oklab; background-image: linear-gradient(var(--tw-gradient-stops)); } ``` Notice how the `,` is removed. This PR fixes that, by moving the `,` to where the variable is being used. The only side effect is that we have to guarantee that the `--tw-gradient-position` is always present. In our testing (and using UI tests) this should be the case. Related Prettier issue: prettier/prettier#17058 Fixes: #16037
- Loading branch information
1 parent
0d5e2be
commit 2242941
Showing
6 changed files
with
112 additions
and
107 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.