-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate arbitrary values to bare values #14669
Conversation
let percentage = parseFloat(clone.value.value) | ||
if (percentage >= 50 && percentage <= 200) { | ||
changed = true | ||
clone.value = { | ||
kind: 'named', | ||
value: clone.value.value, | ||
fraction: null, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think only whole numbers are valid for bare values but this might also convert e.g. font-stretch-[50.5%]
now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, let's clean that up. Created a separate PR to solve the actual issue in the utility: #14670
d9ee84f
to
b436ef9
Compare
b436ef9
to
0d31180
Compare
This PR adds a codemod that can convert arbitrary values to the cleaner bare values if we can.
For example, some classes use arbitrary values such as
col-start-[16]
, but in v4 we have bare values for some plugins that don't really need to adhere to your design system.In this case, we can convert
col-start-[16]
to justcol-start-16
.Another use case is for utilities that use fractions. For example the
aspect-*
plugin.A custom aspect ratio such as
aspect-[16/9]
can be converted toaspect-16/9
.There are some rules attached to this migration: