[4/6] build: import XModule source SCSS directly rather than copying - #32289
Merged
kdmccormick merged 1 commit intoJun 14, 2023
Merged
Conversation
This was referenced May 23, 2023
This was referenced May 23, 2023
kdmccormick
force-pushed
the
kdmccormick/xmodule-scss-copying
branch
from
June 6, 2023 13:41
66e6f4e to
b35dd95
Compare
kdmccormick
marked this pull request as ready for review
June 6, 2023 13:46
The `xmodule_assets` command copies SCSS source files from
xmodule/css to common/static/xmodule/scss, renaming them
to `{MD5_HASH}.scss` in order to "remove duplicates".
The copied files are then included into the generated
SCSS entrypoint files (eg AnnotatableBlockStudio.scss).
The "de-deplication" is completely unnecessary: there are
only a couple dozen SCSS files, and none of them are duplicates.
This copying process is confusing, it complicates our
build process, and it makes our SCSS harder to understand.
So, in the generated SCSS entrypoint files, we
stop importing the *copied* SCSS sources, and just
import the *original* SCSS sources instead.
For example, common/static/xmodule/descriptors/scss/AboutBlockStudio.scss
is changed from:
.xmodule_edit.xmodule_AboutBlock {
@import "9bdcda00f046f78be79aca7791e1d4fb.scss";
@import "a10fc3e0fd6aca63426a89e75fe69c31.scss";
}
to:
.xmodule_edit.xmodule_AboutBlock {
@import "editor/edit.scss";
@import "html/edit.scss";
}
In order to make the `@import` lines work, we add xmodule/css to the list
of lookup dirs for XModule SCSS compilation. We also remove the
copying logic from `xmodule_assets`, as it is no longer needed.
Part of: openedx#32292
kdmccormick
force-pushed
the
kdmccormick/xmodule-scss-copying
branch
from
June 14, 2023 14:15
b35dd95 to
c90964e
Compare
feanil
approved these changes
Jun 14, 2023
feanil
left a comment
Contributor
There was a problem hiding this comment.
Change makes sense and I was able to get it up in tutor and didn't see any issues in a quick browsing of studio or the LMS.
Contributor
|
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production. |
Contributor
|
EdX Release Notice: This PR has been deployed to the production environment. |
kdmccormick
added a commit
to kdmccormick/openedx-platform
that referenced
this pull request
Jun 16, 2023
`xmodule_assets` generated a series of SCSS "entrypoint" files, where each entrypoint file imported from the SCSS "sources" in xmodule/css. This process was more complicated up until very recently; for context, make sure you've seen: * openedx#32288 * openedx#32289 Now that the process is simpler, though, there is no reason to generate the SCSS entrypoints; we can just commit them to the repository instead! So, we go from this: # GENERATED: SCSS entrypoints files for CMS common/static/xmodule/descriptors: AboutBlockStudio.scss AnnotatableBlockStudio.scss ... # GENERATED: SCSS entrypoints files for LMS common/static/xmodule/modules: AboutBlockPreview.scss AnnotatableBlockPreview.scss ... # VERSION CONTROLLED: SCSS source files xmodule/css: annotatable/... capa/... ... to this: # VERSION CONTROLLED: All XModule SCSS xmodule/static/sass: # Source files include: annotatable/... capa/... ... # CMS entrypoint files cms: AboutBlockStudio.scss AnnotatableBlockStudio.scss ... # LMS source files lms: AboutBlockPreview.scss AnnotatableBlockPreview.scss ... Also, we are able to remove all SCSS-related logic from the `xmodule_assets` script and from the `HTMLSnippet` class. XModule JS assets still need processing, but we will address those in a separate series of PRs. Part of: openedx#32292
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supporting information
This is a part of a series of PRs:
The previous PR is:
The next PR is:
Description
The
xmodule_assetscommand copies SCSS source files fromxmodule/css to common/static/xmodule/scss, renaming them
to
{MD5_HASH}.scssin order to "remove duplicates".The copied files are then included into the generated
SCSS entrypoint files (eg AnnotatableBlockStudio.scss).
The "de-deplication" is completely unnecessary: there are
only a couple dozen SCSS files, and none of them are duplicates.
This copying process is confusing, it complicates our
build process, and it makes our SCSS harder to understand.
So, in the generated SCSS entrypoint files, we
stop importing the copied SCSS sources, and just
import the original SCSS sources instead.
For example, common/static/xmodule/descriptors/scss/AboutBlockStudio.scss
is changed from:
to:
In order to make the
@importlines work, we add xmodule/css to the listof lookup dirs for XModule SCSS compilation. We also remove the
copying logic from
xmodule_assets, as it is no longer needed.Testing Instructions
Deadline
Medium-high urgency, as this is in the critical path to a long line of DevX improvement PRs.