-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Convert sass variables to css variables #35385
Conversation
87063d8
to
0c7d786
Compare
632b6bf
to
63a6b9c
Compare
@farhan ty for writing up those issues. Regarding issue 1, seems that there is no Regarding issue 2, from my research it seems that string concatenation in CSS just simply isn't supported. Perhaps an easy for for both issues 1 and 2 would be to define new CSS variables in _builtin-block-variables.scss : :root {
...
--error-color-dark: darken($error-color, 11%);
--error-color-light: lighten($error-color, 25%);
--unanswered-icon-url: '#{var(--static-path)}/images/unanswered-icon.png';
...
} how does that look? |
@kdmccormick @kdmccormick Followup question: |
252fd10
to
ea08309
Compare
ea08309
to
3fdb217
Compare
@kdmccormick Another issue is identified, details added in description: |
The general edx-platform Sass infrastructure must remain until the very last legacy frontend is converted into a React micro-frontend. That will not be for another year or two. The Sass variables we use in _builtin-block-variables.scss will remain available for the time being. However, we will stop compiling built-in XBlock Sass in particular as part of this ticket: #35300 |
Yes, you can hard code the value of |
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.
The code is looking good! Once you apply the all-input-types
change you've proposed @farhan , I'll give it a manual test, and then we should be good to ship this.
Sandbox deployment successful 🚀 |
64a78c5
to
e35f3a5
Compare
e35f3a5
to
e666b81
Compare
Sandbox deployment successful 🚀 |
@kdmccormick PR is rebased and ready to ship from my side. FYI We have already shipped Annotatable XBlock in PR tested by me and @irtazaakram . |
Sandbox deployment successful 🚀 |
Sandbox deployment successful 🚀 |
Sandbox deployment successful 🚀 |
Sandbox deployment successful 🚀 |
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 was able to confirm that this works. For instance, here is a site running a tutor-indigo theme where the primary color is set to pink:
What is happening is:
- we install tutor-indigo with
INDIGO_PRIMARY_COLOR=#dd00dd
(pink): - tutor-indigo sets
$primary: {{ INDIGO_PRIMARY_COLOR }}
- edx-platform's base sass sets
$general-color-accent: theme-color("primary") !default;
- edx-platform's _builtin-block-variables.scss module sets
--general-accent-color: $general-accent-color
- the ProblemBlock answer notification widget references
var(--general-accent-color)
, which, as expected, turns out pink.
This demonstrates to me that the style variables are all being passed down from Sass to CSS as we want them to 👍🏻 Great work @farhan !
One very minor note @farhan , I will be squashing your commit with a |
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
2U Release Notice: This PR has been deployed to the edX production environment. |
1 similar comment
2U Release Notice: This PR has been deployed to the edX production environment. |
|
||
margin-top: -0.6em; | ||
font-family: 'FontAwesome'; | ||
content: "\f142"; | ||
color: $white; | ||
color: var(--white); |
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 line resolves incorrectly in the built CSS:
color: var(--#fff)
Instead of
color: var(--white);
// or
color: #fff;
Ticket: #35306
Relevant PR's
Predecessor PR: #35233
Next ticket: #35300
Word Cloud & Annotatable XBlocks have already been merged in following PR's
These PR's were merged earlier to check the impact of early sass to css variables migration on the production.
Word Cloud XBlock: #35386
Annotatable XBlock: #35409
Dropping use of sass/css variable:
We will drop use of
$all-text-inputs
in the filexmodule/assets/capa/_display.scss
at line ~1075It will be compiled into following css in ticket and only that css will be used in future
Compiled Sass, picking values from global css variables:
Possible ripples (God forbid) PR merging could produce: