-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
### Tasks and PRs
- [x] https://github.com/openedx/edx-platform/issues/31932
- [ ] https://github.com/openedx/edx-platform/pull/32121
- [ ] https://github.com/openedx/edx-platform/pull/32018
- [ ] https://github.com/openedx/edx-platform/pull/32188
- [ ] https://github.com/openedx/edx-platform/pull/32237
- [ ] https://github.com/openedx/edx-platform/issues/32292
- [ ] https://github.com/openedx/edx-platform/issues/32481
Background
This issue helps towards several different initiatives:
edx-platform serves pure [1] XBlocks assets by implementing the standard Django Storage and Finder classes, which tells Django to looks for static assets within the resources_dir of all installed XBlock packages. Importantly, this finder filters out all py, pyc, and scss files. That is because none of those files should be served directly to the browser.
Some pure XBlocks, such as ORA2, use SCSS. That is fine, but it means ORA2 must compile that SCSS in CSS as part of the package publishing process. That way, when ORA2 is installed into edx-platform, the generated CSS is ready to be served without any further processing.
XModule-style [1] XBlocks, on the other hand, are treated differently. Several of these blocks have SCSS, but the SCSS is not compiled into CSS files in the XBlock resource_dirs. Instead, the SCSS is copied to common/lib/xmodule, using the xmodule_assets script defined here and declared here. Once copied, the SCSS is included into other LMS and CMS SCSS files; thus, the styles for these XBlocks are co-mingled with the styles for LMS and CMS.
We would like to get rid of the xmodule_assets script for a couple of reasons:
- It makes the XBlock runtime in edx-platform harder to understand.
- It makes it harder to deprecate and remove legacy LMS & CMS frontends, because the styles are tangled up with certain XBlocks' styles.
- It is written in Python, which makes our static asset build process depend on Python, edx-platform code, and edx-platform Python requirements. This is very bad for build cache-ability. However, we could work around this problem in the short term by rewriting xmodule_assets in pure Bash:
For additional background on xmodule_assets, see the openedx-assets xmodule section of OpenCraft's discovery doc.
[1] By "XModule-style XBlocks", I mean: a set of older XBlock types declared in the ./xmodule/ directory of edx-platform, which rely on the xmodule_assets copying mechanims. The list is here. All other XBlocks types are considered "pure XBlocks".
Alternative
If we need an intermediate solution and/or if we think this issue is harder than it is worth, then we can instead do:
Follow-up work
After the critical work in this epic is complete, further cleanup work could be done in: