-
Notifications
You must be signed in to change notification settings - Fork 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
feat: move general imports to specific scss files #32121
Conversation
Thanks for the pull request, @andrey-canon! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
957ae72
to
6153b99
Compare
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 this will be a good change, but I have some questions to make sure that I understand it.
@@ -147,10 +147,8 @@ def _write_styles(selector, output_root, classes, css_attribute): | |||
for class_ in classes: | |||
css_imports[class_].add(fragment_name) | |||
|
|||
module_styles_lines = [ | |||
"@import 'bourbon/bourbon';", | |||
"@import 'lms/theme/variables';", |
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.
Is it true that none of the XModules use lms/theme/variables?
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.
no, that's false, probably one of them uses lms/theme/variables
, however in this context it's hard to know which one, because the file _module-styles.scss
is imported in a bigger file (_build-course.scss or _build-v1.scss) that already import that.
if you check this list after decoupling you will find that more of one import is necessary
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.
Got it. Do you want to merge this PR first? If so, when you rebase the decoupling PR, do you think you will put @import 'lms/theme/variables';
back for some files?
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.
yes, I'd like to merge this one first, in that way I can add just the required imports in the specific files in this PR
|
||
.blue-button { | ||
@include blue-button; | ||
} |
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.
Sorry, I am having trouble understanding what you mean here:
That was happening because the import order had changed and an specific button mixin was not overridden by bourbon, the file that generates that difference is this one, that use the blue-button mixin, and that mixin use inside the button mixin in this line, when the bourbon import is made in the file openedx-assets xmodule that override the button mixin with this however when I applied this changes that uses this mixin
As I understand it, you are removing this block because it generates extra CSS in the video editor (which is the only thing that uses tabs.scss), but that CSS has no visual impact on the video editor, right?
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.
yes, that is the conclusion, that has no visual impact, the comment is probably a bad explanation of why the blue-button style change when I change the import place, but at the end it doesn't matter since that class doesn't exist in the current video editor
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.
Sounds good to me 👍🏻
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.
@andrey-canon Nice work, this looks good to me. Please just rebase & add some extra details to your commit message as well as a link back to the parent issue (#31624). I should be able to merge this as early as tomorrow.
This moves scss imports to a specific file where that is required instead of having a common XModule import list. This is part of openedx#31624
6153b99
to
89ca5e8
Compare
@andrey-canon 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production. |
EdX Release Notice: This PR has been deployed to the production environment. |
Description
This pull request change the way how the scss xmodule imports are made, currently this line adds
bourbun
andlms/theme/variables
as general imports at the top of the file_module-styles.scss
that is generated after running the commandopenedx-assets xmodule
, exampleThis makes harder to know which file really needs of that import to compile and it will generate css files bigger after decoupling process as this pr suggest.
Results and conclusions
For the lms(http://local.overhang.io:8000/static/css/lms-course.css), the difference was just two lines
That was due to I removed
"@import 'lms/theme/variables';",
however that line is redundant that import is made 4 times in the master branch with this it's just made two timesFor cms(http://studio.local.overhang.io:8001/static/studio/css/studio-main-v1.css), when I just remove the general import the difference was bigger the results were the following:
Same case as lms

font weight was set to the selector

.xmodule_edit.xmodule_VideoBlock .component-tab .blue-button
more attributes were set for the selector

.xmodule_edit.xmodule_VideoBlock .component-tab .blue-button
4 Multiple changes all related with `.xmodule_edit.xmodule_VideoBlock .component-tab .blue-button

That was happening because the import order had changed and an specific button mixin was not overridden by bourbon, the file that generates that difference is this one, that use the blue-button mixin, and that mixin use inside the button mixin in this line, when the bourbon import is made in the file
openedx-assets xmodule
that override the button mixin with this however when I applied this changes that uses this mixinI consider those changes doesn't make any difference in the visual resul since currently that class is not present in the studio editor template
Therefore the visual result is the same and I also made a visual comparison to verify that, for that reason I think the best option is to remove that class from the style file and the final result for cms is the next
Testing instructions
To test this a comparison is required, so follow the next instructions with first the master branch and then with this.(Those instructions are base on a tutor environment)
docker exec -it tutor_nightly_dev-lms-1 /bin/bash
openedx-assets xmodule && openedx-assets common
. (probably with master branch this is not necessary since this is part of the provision process)Repeat with and/move_general_imports branch
After that you will have to compare the result of the master branch and the pr branch, I used this page
If you don't want to compare the compiled filed, you can use a online beautifier like this https://www.cleancss.com/css-beautify/ and compare that result