Skip to content

Commit

Permalink
build: commit XModule SCSS entrypoints of generating them (openedx#32290
Browse files Browse the repository at this point in the history
)

`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 (see PRs in issue linked below for more
context). 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
  • Loading branch information
kdmccormick committed Jun 16, 2023
1 parent ee0bdec commit 0b455e0
Show file tree
Hide file tree
Showing 48 changed files with 69 additions and 159 deletions.
10 changes: 4 additions & 6 deletions pavelib/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,8 @@ def get_theme_sass_dirs(system, theme_dir):
css_dir = theme_dir / system / "static" / "css"
certs_sass_dir = theme_dir / system / "static" / "certificates" / "sass"
certs_css_dir = theme_dir / system / "static" / "certificates" / "css"
xmodule_sass_folder = "modules" if system == 'lms' else "descriptors"
xmodule_sass_dir = path("common") / "static" / "xmodule" / xmodule_sass_folder / "scss"
xmodule_lookup_dir = path("xmodule") / "css"
xmodule_sass_dir = path("xmodule") / "static" / "sass" / system
xmodule_lookup_dir = path("xmodule") / "static" / "sass" / "include"

dependencies = SASS_LOOKUP_DEPENDENCIES.get(system, [])
if sass_dir.isdir():
Expand Down Expand Up @@ -238,9 +237,8 @@ def get_system_sass_dirs(system):
dirs = []
sass_dir = path(system) / "static" / "sass"
css_dir = path(system) / "static" / "css"
xmodule_sass_folder = "modules" if system == 'lms' else "descriptors"
xmodule_sass_dir = path("common") / "static" / "xmodule" / xmodule_sass_folder / "scss"
xmodule_lookup_dir = path("xmodule") / "css"
xmodule_sass_dir = path("xmodule") / "static" / "sass" / system
xmodule_lookup_dir = path("xmodule") / "static" / "sass" / "include"

dependencies = SASS_LOOKUP_DEPENDENCIES.get(system, [])
dirs.append({
Expand Down
10 changes: 0 additions & 10 deletions xmodule/annotatable_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,13 @@ class AnnotatableBlock(
],
'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js'),
}
preview_view_css = {
'scss': [
resource_filename(__name__, 'css/annotatable/display.scss'),
],
}

studio_view_js = {
'js': [
resource_filename(__name__, 'js/src/raw/edit/xml.js'),
],
'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js'),
}
studio_view_css = {
'scss': [
resource_filename(__name__, 'css/codemirror/codemirror.scss'),
],
}
studio_js_module_name = "XMLEditingDescriptor"
mako_template = "widgets/raw-edit.html"

Expand Down
13 changes: 0 additions & 13 deletions xmodule/capa_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,26 +177,13 @@ class ProblemBlock(
'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js')
}

preview_view_css = {
'scss': [
resource_filename(__name__, 'css/capa/display.scss'),
],
}

studio_view_js = {
'js': [
resource_filename(__name__, 'js/src/problem/edit.js'),
],
'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js'),
}

studio_view_css = {
'scss': [
resource_filename(__name__, 'css/editor/edit.scss'),
resource_filename(__name__, 'css/problem/edit.scss'),
]
}

display_name = String(
display_name=_("Display Name"),
help=_("The display name for this component."),
Expand Down
6 changes: 0 additions & 6 deletions xmodule/conditional_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,13 @@ class ConditionalBlock(
],
'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js'),
}
preview_view_css = {
'scss': [],
}

mako_template = 'widgets/metadata-edit.html'
studio_js_module_name = 'SequenceDescriptor'
studio_view_js = {
'js': [resource_filename(__name__, 'js/src/sequence/edit.js')],
'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js'),
}
studio_view_css = {
'scss': [],
}

# Map
# key: <tag attribute in xml>
Expand Down
7 changes: 0 additions & 7 deletions xmodule/html_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ def studio_view(self, _context):
],
'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js'),
}
preview_view_css = {'scss': [resource_filename(__name__, 'css/html/display.scss')]}

uses_xmodule_styles_setup = True

Expand All @@ -168,12 +167,6 @@ def studio_view(self, _context):
],
'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js'),
}
studio_view_css = {
'scss': [
resource_filename(__name__, 'css/editor/edit.scss'),
resource_filename(__name__, 'css/html/edit.scss')
]
}

# VS[compat] TODO (cpennington): Delete this method once all fall 2012 course
# are being edited in the cms
Expand Down
6 changes: 0 additions & 6 deletions xmodule/library_content_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@ class LibraryContentBlock(
'js': [],
'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js'),
}
preview_view_css = {
'scss': [],
}

mako_template = 'widgets/metadata-edit.html'
studio_js_module_name = "VerticalDescriptor"
Expand All @@ -111,9 +108,6 @@ class LibraryContentBlock(
],
'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js'),
}
studio_view_css = {
'scss': [],
}

show_in_read_only_mode = True

Expand Down
8 changes: 0 additions & 8 deletions xmodule/lti_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,6 @@ class LTIBlock(
],
'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js'),
}
preview_view_css = {
'scss': [
resource_filename(__name__, 'css/lti/lti.scss')
],
}

mako_template = 'widgets/metadata-only-edit.html'

Expand All @@ -393,9 +388,6 @@ class LTIBlock(
],
'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js'),
}
studio_view_css = {
'scss': [],
}

def studio_view(self, _context):
"""
Expand Down
9 changes: 0 additions & 9 deletions xmodule/poll_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,6 @@ class PollBlock(
],
'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js'),
}
preview_view_css = {
'scss': [
resource_filename(__name__, 'css/poll/display.scss')
],
}

# There is no studio_view() for this XBlock but this is needed to make the
# the static_content command happy.
Expand All @@ -105,10 +100,6 @@ class PollBlock(
'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js')
}

studio_view_css = {
'scss': []
}

def handle_ajax(self, dispatch, data): # lint-amnesty, pylint: disable=unused-argument
"""Ajax handler.
Expand Down
10 changes: 0 additions & 10 deletions xmodule/seq_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,23 +278,13 @@ class SequenceBlock(
'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js')
}

preview_view_css = {
'scss': [
resource_filename(__name__, 'css/sequence/display.scss'),
],
}

# There is no studio_view() for this XBlock but this is needed to make the
# the static_content command happy.
studio_view_js = {
'js': [],
'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js')
}

studio_view_css = {
'scss': []
}

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

Expand Down
6 changes: 0 additions & 6 deletions xmodule/split_test_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,13 @@ class SplitTestBlock( # lint-amnesty, pylint: disable=abstract-method
'js': [],
'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js'),
}
preview_view_css = {
'scss': [],
}

mako_template = "widgets/metadata-only-edit.html"
studio_js_module_name = 'SequenceDescriptor'
studio_view_js = {
'js': [resource_filename(__name__, 'js/src/sequence/edit.js')],
'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js'),
}
studio_view_css = {
'scss': [],
}

@cached_property
def child_block(self):
Expand Down
4 changes: 4 additions & 0 deletions xmodule/static/sass/cms/AboutBlockStudio.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.xmodule_edit.xmodule_AboutBlock {
@import "editor/edit.scss";
@import "html/edit.scss";
}
3 changes: 3 additions & 0 deletions xmodule/static/sass/cms/AnnotatableBlockStudio.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.xmodule_edit.xmodule_AnnotatableBlock {
@import "codemirror/codemirror.scss";
}
4 changes: 4 additions & 0 deletions xmodule/static/sass/cms/CourseInfoBlockStudio.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.xmodule_edit.xmodule_CourseInfoBlock {
@import "editor/edit.scss";
@import "html/edit.scss";
}
3 changes: 3 additions & 0 deletions xmodule/static/sass/cms/CustomTagBlockStudio.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.xmodule_edit.xmodule_CustomTagBlock {
@import "codemirror/codemirror.scss";
}
4 changes: 4 additions & 0 deletions xmodule/static/sass/cms/HtmlBlockStudio.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.xmodule_edit.xmodule_HtmlBlock {
@import "editor/edit.scss";
@import "html/edit.scss";
}
4 changes: 4 additions & 0 deletions xmodule/static/sass/cms/ProblemBlockStudio.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.xmodule_edit.xmodule_ProblemBlock {
@import "editor/edit.scss";
@import "problem/edit.scss";
}
4 changes: 4 additions & 0 deletions xmodule/static/sass/cms/StaticTabBlockStudio.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.xmodule_edit.xmodule_StaticTabBlock {
@import "editor/edit.scss";
@import "html/edit.scss";
}
3 changes: 3 additions & 0 deletions xmodule/static/sass/cms/VideoBlockStudio.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.xmodule_edit.xmodule_VideoBlock {
@import "tabs/tabs.scss";
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions xmodule/static/sass/lms/AboutBlockPreview.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.xmodule_display.xmodule_AboutBlock {
@import "html/display.scss";
}
3 changes: 3 additions & 0 deletions xmodule/static/sass/lms/AnnotatableBlockPreview.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.xmodule_display.xmodule_AnnotatableBlock {
@import "annotatable/display.scss";
}
3 changes: 3 additions & 0 deletions xmodule/static/sass/lms/CourseInfoBlockPreview.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.xmodule_display.xmodule_CourseInfoBlock {
@import "html/display.scss";
}
3 changes: 3 additions & 0 deletions xmodule/static/sass/lms/HtmlBlockPreview.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.xmodule_display.xmodule_HtmlBlock {
@import "html/display.scss";
}
3 changes: 3 additions & 0 deletions xmodule/static/sass/lms/LTIBlockPreview.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.xmodule_display.xmodule_LTIBlock {
@import "lti/lti.scss";
}
3 changes: 3 additions & 0 deletions xmodule/static/sass/lms/PollBlockPreview.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.xmodule_display.xmodule_PollBlock {
@import "poll/display.scss";
}
3 changes: 3 additions & 0 deletions xmodule/static/sass/lms/ProblemBlockPreview.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.xmodule_display.xmodule_ProblemBlock {
@import "capa/display.scss";
}
3 changes: 3 additions & 0 deletions xmodule/static/sass/lms/SequenceBlockPreview.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.xmodule_display.xmodule_SequenceBlock {
@import "sequence/display.scss";
}
3 changes: 3 additions & 0 deletions xmodule/static/sass/lms/StaticTabBlockPreview.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.xmodule_display.xmodule_StaticTabBlock {
@import "html/display.scss";
}
4 changes: 4 additions & 0 deletions xmodule/static/sass/lms/VideoBlockPreview.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.xmodule_display.xmodule_VideoBlock {
@import "video/display.scss";
@import "video/accessible_menu.scss";
}
3 changes: 3 additions & 0 deletions xmodule/static/sass/lms/WordCloudBlockPreview.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.xmodule_display.xmodule_WordCloudBlock {
@import "word_cloud/display.scss";
}
Loading

0 comments on commit 0b455e0

Please sign in to comment.