-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Add suggestions when --spacing(--value(integer, number)) is used
#17308
Add suggestions when --spacing(--value(integer, number)) is used
#17308
Conversation
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.
yessssss ty!
8a00834 to
d54b2d0
Compare
Output is based on the result of: CSS: ```css @import "tailwindcss"; @theme { --spacing: 0.25rem; --spacing-custom: 123px; } @Utility with-custom-spacing-* { size: --value(--spacing); } @Utility with-integer-spacing-* { size: --spacing(--value(integer)); } @Utility with-number-spacing-* { size: --spacing(--value(number)); } ``` HTML: ```html <div class="with-custom-spacing-custom"></div> <div class="with-custom-spacing-0"></div> <div class="with-custom-spacing-0.5"></div> <div class="with-custom-spacing-1"></div> <div class="with-custom-spacing-1.5"></div> <div class="with-integer-spacing-custom"></div> <div class="with-integer-spacing-0"></div> <div class="with-integer-spacing-0.5"></div> <div class="with-integer-spacing-1"></div> <div class="with-integer-spacing-1.5"></div> <div class="with-number-spacing-custom"></div> <div class="with-number-spacing-0"></div> <div class="with-number-spacing-0.5"></div> <div class="with-number-spacing-1"></div> <div class="with-number-spacing-1.5"></div> ``` Play: https://play.tailwindcss.com/tYDaSNiNtS
- When `--value(--spacing)` is used, then `--spacing` theme key suggestions will be used. - When `--spacing(--value(integer))` is used, then `--spacing` scale suggestions will be used, but _only_ for `integer` values. - When `--spacing(--value(number))` is used, then `--spacing` scale suggestions will be used, but for all values.
d54b2d0 to
ae89775
Compare
|
@RobinMalfait (sorry, probably trivial...) Sorry for the trivial noob questions; but I'm having a hard time wrapping my head around the new plugin system and want to make sure that it's not working for me, because it just can't yet :D:D – Any way for me to see if this PR has been released yet? EDIT: Also I don't quite get why your HTML examples show EDIT2: Also also :D – cool that this system easily allows to only suggest custom values <3 EDIT3...: It feels a bit odd that both |
Correct it's not yet released. You have to be on the insiders build in order to get suggestions. If you switch the Play link to use the insiders version it should work. See: https://play.tailwindcss.com/VaNteSLX3A
Yep, checkout the CHANGELOG.md file for this: https://github.com/tailwindlabs/tailwindcss/blob/main/CHANGELOG.md#unreleased
I just copied the 3 types of plugins with the exact same values. Then verified what actually got generated (see Generated CSS tab at the bottom). Let me annotation it for you: https://play.tailwindcss.com/ZiGsqoXgwV
It is a bit odd, but this is how CSS defines custom functions, they just look like a CSS variable.
In this case
Yes, should already be the case:
Correct, just need to be on the correct version 😁
|







This PR adds suggestions to CSS based functional utilities when the
--spacing(…)function is used.Given this CSS:
And this HTML:
Play: https://play.tailwindcss.com/tYDaSNiNtS
Then you will see the following suggestions:
This is because
--spacing(--value(number))will include all default spacing scale suggestions we use. And--pacing(--value(integer))will include the same list but without the floating point numbers.Follow up PR for: #17304