-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Replace breakpoint width sass variables with css variables #1952
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
Replace breakpoint width sass variables with css variables #1952
Conversation
🦋 Changeset detectedLatest commit: 73efb89 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Co-authored-by: Keith Cirkel <keithamus@users.noreply.github.com>
Co-authored-by: Keith Cirkel <keithamus@users.noreply.github.com>
fc86a0e to
65f0f2b
Compare
Co-authored-by: Keith Cirkel <keithamus@users.noreply.github.com>
| // For < md it will show full-width anchored to the bottom | ||
|
|
||
| @media (max-width: ($width-md - 0.02px)) { | ||
| @media (max-width: calc(var(--width-md) - 0.02px)) { |
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.
This needs to be a calc call since we are now using CSS variables and not the SASS compiler to add up these values.
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.
Hey @koddsson! This is a great idea. We're actually working on this right now, but in primer-primitives https://github.com/github/primer/issues/709. Do you need CSS vars urgently, or would you be willing to wait for us to roll this into primitives?
Further, CSS vars can't be used within @media queries out of the box. There's a PostCSS plugin we will likely implement with the primitives work 😄
No rush! The overarching task is to replace any SASS compiler in our toolchain with PostCSS plugins. This looked like a good place to start and kickstart a dialogue on if this is the right approach. I'll close this as being worked on somewhere else.
Thanks! I did not know this 😬 |
What are you trying to accomplish?
I want to start migrating away from using SASS and start to use the native CSS features where we can.
What approach did you choose and why?
This PR starts by exposing breakpoints variables as CSS variables. If we do this for all SASS variables, we can start deprecating SASS variables, consuming applications can start migrating and we then remove all SASS variables in a breaking change once we've done all the migrations.
Diff
Diff of the changes
Are additional changes needed?