Refactor gradient implementation to work around prettier/prettier#17058 #16072
+112
−107
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 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 thevar(--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.: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