From 0b455e0336fa54199fd992c2ce83a81c07dd07c2 Mon Sep 17 00:00:00 2001 From: Kyle McCormick Date: Fri, 16 Jun 2023 08:51:03 -0400 Subject: [PATCH] build: commit XModule SCSS entrypoints of generating them (#32290) `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: https://github.com/openedx/edx-platform/issues/32292 --- pavelib/assets.py | 10 ++-- xmodule/annotatable_block.py | 10 ---- xmodule/capa_block.py | 13 ----- xmodule/conditional_block.py | 6 -- xmodule/html_block.py | 7 --- xmodule/library_content_block.py | 6 -- xmodule/lti_block.py | 8 --- xmodule/poll_block.py | 9 --- xmodule/seq_block.py | 10 ---- xmodule/split_test_block.py | 6 -- xmodule/static/sass/cms/AboutBlockStudio.scss | 4 ++ .../sass/cms/AnnotatableBlockStudio.scss | 3 + .../sass/cms/CourseInfoBlockStudio.scss | 4 ++ .../static/sass/cms/CustomTagBlockStudio.scss | 3 + xmodule/static/sass/cms/HtmlBlockStudio.scss | 4 ++ .../static/sass/cms/ProblemBlockStudio.scss | 4 ++ .../static/sass/cms/StaticTabBlockStudio.scss | 4 ++ xmodule/static/sass/cms/VideoBlockStudio.scss | 3 + .../sass/include}/annotatable/display.scss | 0 .../sass/include}/capa/display.scss | 0 .../sass/include}/codemirror/codemirror.scss | 0 .../sass/include}/editor/edit.scss | 0 .../sass/include}/html/display.scss | 0 .../sass/include}/html/edit.scss | 0 .../{css => static/sass/include}/lti/lti.scss | 0 .../sass/include}/poll/display.scss | 0 .../sass/include}/problem/edit.scss | 0 .../sass/include}/sequence/display.scss | 0 .../sass/include}/tabs/codemirror.scss | 0 .../sass/include}/tabs/tabs.scss | 0 .../sass/include}/video/accessible_menu.scss | 0 .../sass/include}/video/display.scss | 0 .../sass/include}/word_cloud/display.scss | 0 .../static/sass/lms/AboutBlockPreview.scss | 3 + .../sass/lms/AnnotatableBlockPreview.scss | 3 + .../sass/lms/CourseInfoBlockPreview.scss | 3 + xmodule/static/sass/lms/HtmlBlockPreview.scss | 3 + xmodule/static/sass/lms/LTIBlockPreview.scss | 3 + xmodule/static/sass/lms/PollBlockPreview.scss | 3 + .../static/sass/lms/ProblemBlockPreview.scss | 3 + .../static/sass/lms/SequenceBlockPreview.scss | 3 + .../sass/lms/StaticTabBlockPreview.scss | 3 + .../static/sass/lms/VideoBlockPreview.scss | 4 ++ .../sass/lms/WordCloudBlockPreview.scss | 3 + xmodule/static_content.py | 55 +------------------ xmodule/template_block.py | 6 -- xmodule/word_cloud_block.py | 8 --- xmodule/x_module.py | 11 ---- 48 files changed, 69 insertions(+), 159 deletions(-) create mode 100644 xmodule/static/sass/cms/AboutBlockStudio.scss create mode 100644 xmodule/static/sass/cms/AnnotatableBlockStudio.scss create mode 100644 xmodule/static/sass/cms/CourseInfoBlockStudio.scss create mode 100644 xmodule/static/sass/cms/CustomTagBlockStudio.scss create mode 100644 xmodule/static/sass/cms/HtmlBlockStudio.scss create mode 100644 xmodule/static/sass/cms/ProblemBlockStudio.scss create mode 100644 xmodule/static/sass/cms/StaticTabBlockStudio.scss create mode 100644 xmodule/static/sass/cms/VideoBlockStudio.scss rename xmodule/{css => static/sass/include}/annotatable/display.scss (100%) rename xmodule/{css => static/sass/include}/capa/display.scss (100%) rename xmodule/{css => static/sass/include}/codemirror/codemirror.scss (100%) rename xmodule/{css => static/sass/include}/editor/edit.scss (100%) rename xmodule/{css => static/sass/include}/html/display.scss (100%) rename xmodule/{css => static/sass/include}/html/edit.scss (100%) rename xmodule/{css => static/sass/include}/lti/lti.scss (100%) rename xmodule/{css => static/sass/include}/poll/display.scss (100%) rename xmodule/{css => static/sass/include}/problem/edit.scss (100%) rename xmodule/{css => static/sass/include}/sequence/display.scss (100%) rename xmodule/{css => static/sass/include}/tabs/codemirror.scss (100%) rename xmodule/{css => static/sass/include}/tabs/tabs.scss (100%) rename xmodule/{css => static/sass/include}/video/accessible_menu.scss (100%) rename xmodule/{css => static/sass/include}/video/display.scss (100%) rename xmodule/{css => static/sass/include}/word_cloud/display.scss (100%) create mode 100644 xmodule/static/sass/lms/AboutBlockPreview.scss create mode 100644 xmodule/static/sass/lms/AnnotatableBlockPreview.scss create mode 100644 xmodule/static/sass/lms/CourseInfoBlockPreview.scss create mode 100644 xmodule/static/sass/lms/HtmlBlockPreview.scss create mode 100644 xmodule/static/sass/lms/LTIBlockPreview.scss create mode 100644 xmodule/static/sass/lms/PollBlockPreview.scss create mode 100644 xmodule/static/sass/lms/ProblemBlockPreview.scss create mode 100644 xmodule/static/sass/lms/SequenceBlockPreview.scss create mode 100644 xmodule/static/sass/lms/StaticTabBlockPreview.scss create mode 100644 xmodule/static/sass/lms/VideoBlockPreview.scss create mode 100644 xmodule/static/sass/lms/WordCloudBlockPreview.scss diff --git a/pavelib/assets.py b/pavelib/assets.py index 19bb98ea071e..953faf84dee2 100644 --- a/pavelib/assets.py +++ b/pavelib/assets.py @@ -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(): @@ -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({ diff --git a/xmodule/annotatable_block.py b/xmodule/annotatable_block.py index 9ec6bf21dace..e2c6a7a2c554 100644 --- a/xmodule/annotatable_block.py +++ b/xmodule/annotatable_block.py @@ -82,11 +82,6 @@ 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': [ @@ -94,11 +89,6 @@ class AnnotatableBlock( ], '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" diff --git a/xmodule/capa_block.py b/xmodule/capa_block.py index 2b2ec8082534..c70e619f27c9 100644 --- a/xmodule/capa_block.py +++ b/xmodule/capa_block.py @@ -177,12 +177,6 @@ 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'), @@ -190,13 +184,6 @@ class ProblemBlock( '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."), diff --git a/xmodule/conditional_block.py b/xmodule/conditional_block.py index 7fe545d1a307..23ffbae43afa 100644 --- a/xmodule/conditional_block.py +++ b/xmodule/conditional_block.py @@ -154,9 +154,6 @@ 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' @@ -164,9 +161,6 @@ class ConditionalBlock( 'js': [resource_filename(__name__, 'js/src/sequence/edit.js')], 'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js'), } - studio_view_css = { - 'scss': [], - } # Map # key: diff --git a/xmodule/html_block.py b/xmodule/html_block.py index 48786c2c5611..c9f3ddbf4d69 100644 --- a/xmodule/html_block.py +++ b/xmodule/html_block.py @@ -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 @@ -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 diff --git a/xmodule/library_content_block.py b/xmodule/library_content_block.py index 7193247f58d5..2e405371d017 100644 --- a/xmodule/library_content_block.py +++ b/xmodule/library_content_block.py @@ -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" @@ -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 diff --git a/xmodule/lti_block.py b/xmodule/lti_block.py index 76c03d73a671..66bb4e2049c7 100644 --- a/xmodule/lti_block.py +++ b/xmodule/lti_block.py @@ -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' @@ -393,9 +388,6 @@ class LTIBlock( ], 'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js'), } - studio_view_css = { - 'scss': [], - } def studio_view(self, _context): """ diff --git a/xmodule/poll_block.py b/xmodule/poll_block.py index 0ce6d38e1e51..3141c7b71984 100644 --- a/xmodule/poll_block.py +++ b/xmodule/poll_block.py @@ -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. @@ -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. diff --git a/xmodule/seq_block.py b/xmodule/seq_block.py index 250a69d83b6a..c46bb97e0fee 100644 --- a/xmodule/seq_block.py +++ b/xmodule/seq_block.py @@ -278,12 +278,6 @@ 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 = { @@ -291,10 +285,6 @@ class SequenceBlock( 'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js') } - studio_view_css = { - 'scss': [] - } - def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/xmodule/split_test_block.py b/xmodule/split_test_block.py index b638eb7a50ba..229578caef0c 100644 --- a/xmodule/split_test_block.py +++ b/xmodule/split_test_block.py @@ -162,9 +162,6 @@ 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' @@ -172,9 +169,6 @@ class SplitTestBlock( # lint-amnesty, pylint: disable=abstract-method '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): diff --git a/xmodule/static/sass/cms/AboutBlockStudio.scss b/xmodule/static/sass/cms/AboutBlockStudio.scss new file mode 100644 index 000000000000..0af42e47ff02 --- /dev/null +++ b/xmodule/static/sass/cms/AboutBlockStudio.scss @@ -0,0 +1,4 @@ +.xmodule_edit.xmodule_AboutBlock { + @import "editor/edit.scss"; + @import "html/edit.scss"; +} diff --git a/xmodule/static/sass/cms/AnnotatableBlockStudio.scss b/xmodule/static/sass/cms/AnnotatableBlockStudio.scss new file mode 100644 index 000000000000..8f2852422d7d --- /dev/null +++ b/xmodule/static/sass/cms/AnnotatableBlockStudio.scss @@ -0,0 +1,3 @@ +.xmodule_edit.xmodule_AnnotatableBlock { + @import "codemirror/codemirror.scss"; +} diff --git a/xmodule/static/sass/cms/CourseInfoBlockStudio.scss b/xmodule/static/sass/cms/CourseInfoBlockStudio.scss new file mode 100644 index 000000000000..df1af8311546 --- /dev/null +++ b/xmodule/static/sass/cms/CourseInfoBlockStudio.scss @@ -0,0 +1,4 @@ +.xmodule_edit.xmodule_CourseInfoBlock { + @import "editor/edit.scss"; + @import "html/edit.scss"; +} diff --git a/xmodule/static/sass/cms/CustomTagBlockStudio.scss b/xmodule/static/sass/cms/CustomTagBlockStudio.scss new file mode 100644 index 000000000000..3abd162c808d --- /dev/null +++ b/xmodule/static/sass/cms/CustomTagBlockStudio.scss @@ -0,0 +1,3 @@ +.xmodule_edit.xmodule_CustomTagBlock { + @import "codemirror/codemirror.scss"; +} diff --git a/xmodule/static/sass/cms/HtmlBlockStudio.scss b/xmodule/static/sass/cms/HtmlBlockStudio.scss new file mode 100644 index 000000000000..350a80cc5d84 --- /dev/null +++ b/xmodule/static/sass/cms/HtmlBlockStudio.scss @@ -0,0 +1,4 @@ +.xmodule_edit.xmodule_HtmlBlock { + @import "editor/edit.scss"; + @import "html/edit.scss"; +} diff --git a/xmodule/static/sass/cms/ProblemBlockStudio.scss b/xmodule/static/sass/cms/ProblemBlockStudio.scss new file mode 100644 index 000000000000..03d3cf1e2a98 --- /dev/null +++ b/xmodule/static/sass/cms/ProblemBlockStudio.scss @@ -0,0 +1,4 @@ +.xmodule_edit.xmodule_ProblemBlock { + @import "editor/edit.scss"; + @import "problem/edit.scss"; +} diff --git a/xmodule/static/sass/cms/StaticTabBlockStudio.scss b/xmodule/static/sass/cms/StaticTabBlockStudio.scss new file mode 100644 index 000000000000..37fa9ca36030 --- /dev/null +++ b/xmodule/static/sass/cms/StaticTabBlockStudio.scss @@ -0,0 +1,4 @@ +.xmodule_edit.xmodule_StaticTabBlock { + @import "editor/edit.scss"; + @import "html/edit.scss"; +} diff --git a/xmodule/static/sass/cms/VideoBlockStudio.scss b/xmodule/static/sass/cms/VideoBlockStudio.scss new file mode 100644 index 000000000000..eb966091ce46 --- /dev/null +++ b/xmodule/static/sass/cms/VideoBlockStudio.scss @@ -0,0 +1,3 @@ +.xmodule_edit.xmodule_VideoBlock { + @import "tabs/tabs.scss"; +} diff --git a/xmodule/css/annotatable/display.scss b/xmodule/static/sass/include/annotatable/display.scss similarity index 100% rename from xmodule/css/annotatable/display.scss rename to xmodule/static/sass/include/annotatable/display.scss diff --git a/xmodule/css/capa/display.scss b/xmodule/static/sass/include/capa/display.scss similarity index 100% rename from xmodule/css/capa/display.scss rename to xmodule/static/sass/include/capa/display.scss diff --git a/xmodule/css/codemirror/codemirror.scss b/xmodule/static/sass/include/codemirror/codemirror.scss similarity index 100% rename from xmodule/css/codemirror/codemirror.scss rename to xmodule/static/sass/include/codemirror/codemirror.scss diff --git a/xmodule/css/editor/edit.scss b/xmodule/static/sass/include/editor/edit.scss similarity index 100% rename from xmodule/css/editor/edit.scss rename to xmodule/static/sass/include/editor/edit.scss diff --git a/xmodule/css/html/display.scss b/xmodule/static/sass/include/html/display.scss similarity index 100% rename from xmodule/css/html/display.scss rename to xmodule/static/sass/include/html/display.scss diff --git a/xmodule/css/html/edit.scss b/xmodule/static/sass/include/html/edit.scss similarity index 100% rename from xmodule/css/html/edit.scss rename to xmodule/static/sass/include/html/edit.scss diff --git a/xmodule/css/lti/lti.scss b/xmodule/static/sass/include/lti/lti.scss similarity index 100% rename from xmodule/css/lti/lti.scss rename to xmodule/static/sass/include/lti/lti.scss diff --git a/xmodule/css/poll/display.scss b/xmodule/static/sass/include/poll/display.scss similarity index 100% rename from xmodule/css/poll/display.scss rename to xmodule/static/sass/include/poll/display.scss diff --git a/xmodule/css/problem/edit.scss b/xmodule/static/sass/include/problem/edit.scss similarity index 100% rename from xmodule/css/problem/edit.scss rename to xmodule/static/sass/include/problem/edit.scss diff --git a/xmodule/css/sequence/display.scss b/xmodule/static/sass/include/sequence/display.scss similarity index 100% rename from xmodule/css/sequence/display.scss rename to xmodule/static/sass/include/sequence/display.scss diff --git a/xmodule/css/tabs/codemirror.scss b/xmodule/static/sass/include/tabs/codemirror.scss similarity index 100% rename from xmodule/css/tabs/codemirror.scss rename to xmodule/static/sass/include/tabs/codemirror.scss diff --git a/xmodule/css/tabs/tabs.scss b/xmodule/static/sass/include/tabs/tabs.scss similarity index 100% rename from xmodule/css/tabs/tabs.scss rename to xmodule/static/sass/include/tabs/tabs.scss diff --git a/xmodule/css/video/accessible_menu.scss b/xmodule/static/sass/include/video/accessible_menu.scss similarity index 100% rename from xmodule/css/video/accessible_menu.scss rename to xmodule/static/sass/include/video/accessible_menu.scss diff --git a/xmodule/css/video/display.scss b/xmodule/static/sass/include/video/display.scss similarity index 100% rename from xmodule/css/video/display.scss rename to xmodule/static/sass/include/video/display.scss diff --git a/xmodule/css/word_cloud/display.scss b/xmodule/static/sass/include/word_cloud/display.scss similarity index 100% rename from xmodule/css/word_cloud/display.scss rename to xmodule/static/sass/include/word_cloud/display.scss diff --git a/xmodule/static/sass/lms/AboutBlockPreview.scss b/xmodule/static/sass/lms/AboutBlockPreview.scss new file mode 100644 index 000000000000..1df920bc232b --- /dev/null +++ b/xmodule/static/sass/lms/AboutBlockPreview.scss @@ -0,0 +1,3 @@ +.xmodule_display.xmodule_AboutBlock { + @import "html/display.scss"; +} diff --git a/xmodule/static/sass/lms/AnnotatableBlockPreview.scss b/xmodule/static/sass/lms/AnnotatableBlockPreview.scss new file mode 100644 index 000000000000..66e1e756f3da --- /dev/null +++ b/xmodule/static/sass/lms/AnnotatableBlockPreview.scss @@ -0,0 +1,3 @@ +.xmodule_display.xmodule_AnnotatableBlock { + @import "annotatable/display.scss"; +} diff --git a/xmodule/static/sass/lms/CourseInfoBlockPreview.scss b/xmodule/static/sass/lms/CourseInfoBlockPreview.scss new file mode 100644 index 000000000000..ff6353df74e2 --- /dev/null +++ b/xmodule/static/sass/lms/CourseInfoBlockPreview.scss @@ -0,0 +1,3 @@ +.xmodule_display.xmodule_CourseInfoBlock { + @import "html/display.scss"; +} diff --git a/xmodule/static/sass/lms/HtmlBlockPreview.scss b/xmodule/static/sass/lms/HtmlBlockPreview.scss new file mode 100644 index 000000000000..09610448fed5 --- /dev/null +++ b/xmodule/static/sass/lms/HtmlBlockPreview.scss @@ -0,0 +1,3 @@ +.xmodule_display.xmodule_HtmlBlock { + @import "html/display.scss"; +} diff --git a/xmodule/static/sass/lms/LTIBlockPreview.scss b/xmodule/static/sass/lms/LTIBlockPreview.scss new file mode 100644 index 000000000000..ea92202df2ad --- /dev/null +++ b/xmodule/static/sass/lms/LTIBlockPreview.scss @@ -0,0 +1,3 @@ +.xmodule_display.xmodule_LTIBlock { + @import "lti/lti.scss"; +} diff --git a/xmodule/static/sass/lms/PollBlockPreview.scss b/xmodule/static/sass/lms/PollBlockPreview.scss new file mode 100644 index 000000000000..85110778c742 --- /dev/null +++ b/xmodule/static/sass/lms/PollBlockPreview.scss @@ -0,0 +1,3 @@ +.xmodule_display.xmodule_PollBlock { + @import "poll/display.scss"; +} diff --git a/xmodule/static/sass/lms/ProblemBlockPreview.scss b/xmodule/static/sass/lms/ProblemBlockPreview.scss new file mode 100644 index 000000000000..5175529246b0 --- /dev/null +++ b/xmodule/static/sass/lms/ProblemBlockPreview.scss @@ -0,0 +1,3 @@ +.xmodule_display.xmodule_ProblemBlock { + @import "capa/display.scss"; +} diff --git a/xmodule/static/sass/lms/SequenceBlockPreview.scss b/xmodule/static/sass/lms/SequenceBlockPreview.scss new file mode 100644 index 000000000000..0c5aa3c82c49 --- /dev/null +++ b/xmodule/static/sass/lms/SequenceBlockPreview.scss @@ -0,0 +1,3 @@ +.xmodule_display.xmodule_SequenceBlock { + @import "sequence/display.scss"; +} diff --git a/xmodule/static/sass/lms/StaticTabBlockPreview.scss b/xmodule/static/sass/lms/StaticTabBlockPreview.scss new file mode 100644 index 000000000000..5c044e659b28 --- /dev/null +++ b/xmodule/static/sass/lms/StaticTabBlockPreview.scss @@ -0,0 +1,3 @@ +.xmodule_display.xmodule_StaticTabBlock { + @import "html/display.scss"; +} diff --git a/xmodule/static/sass/lms/VideoBlockPreview.scss b/xmodule/static/sass/lms/VideoBlockPreview.scss new file mode 100644 index 000000000000..ccd9a3ed1326 --- /dev/null +++ b/xmodule/static/sass/lms/VideoBlockPreview.scss @@ -0,0 +1,4 @@ +.xmodule_display.xmodule_VideoBlock { + @import "video/display.scss"; + @import "video/accessible_menu.scss"; +} diff --git a/xmodule/static/sass/lms/WordCloudBlockPreview.scss b/xmodule/static/sass/lms/WordCloudBlockPreview.scss new file mode 100644 index 000000000000..884112a4804c --- /dev/null +++ b/xmodule/static/sass/lms/WordCloudBlockPreview.scss @@ -0,0 +1,3 @@ +.xmodule_display.xmodule_WordCloudBlock { + @import "word_cloud/display.scss"; +} diff --git a/xmodule/static_content.py b/xmodule/static_content.py index 6730dcb7a0ea..80b0b1d14b97 100755 --- a/xmodule/static_content.py +++ b/xmodule/static_content.py @@ -1,7 +1,7 @@ # /usr/bin/env python """ -This module has utility functions for gathering up the static content -that is defined by XModules and XModuleDescriptors (javascript and css) +This module has utility functions for gathering up the javascript +that is defined by XModules and XModuleDescriptors """ @@ -47,12 +47,6 @@ class VideoBlock(HTMLSnippet): # lint-amnesty, pylint: disable=abstract-method ], 'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js') } - preview_view_css = { - 'scss': [ - resource_filename(__name__, 'css/video/display.scss'), - resource_filename(__name__, 'css/video/accessible_menu.scss'), - ], - } studio_view_js = { 'js': [ @@ -61,12 +55,6 @@ class VideoBlock(HTMLSnippet): # lint-amnesty, pylint: disable=abstract-method 'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js'), } - studio_view_css = { - 'scss': [ - resource_filename(__name__, 'css/tabs/tabs.scss'), - ] - } - # List of XBlocks which use this static content setup. # Should only be used for XModules being converted to XBlocks. @@ -89,21 +77,11 @@ class VideoBlock(HTMLSnippet): # lint-amnesty, pylint: disable=abstract-method ] -def write_module_styles(output_root): - """Write all registered XModule css, sass, and scss files to output root.""" - return _write_styles('.xmodule_display', output_root, XBLOCK_CLASSES, 'get_preview_view_css', 'Preview') - - def write_module_js(output_root): """Write all registered XModule js and coffee files to output root.""" return _write_js(output_root, XBLOCK_CLASSES, 'get_preview_view_js') -def write_descriptor_styles(output_root): - """Write all registered XModuleDescriptor css, sass, and scss files to output root.""" - return _write_styles('.xmodule_edit', output_root, XBLOCK_CLASSES, 'get_studio_view_css', 'Studio') - - def write_descriptor_js(output_root): """Write all registered XModuleDescriptor js and coffee files to output root.""" return _write_js(output_root, XBLOCK_CLASSES, 'get_studio_view_js') @@ -120,33 +98,6 @@ def _ensure_dir(directory): raise -def _write_styles(selector, output_root, classes, css_attribute, suffix): - """ - Write the css fragments from all XModules in `classes` - into `output_root` as individual files - """ - contents = {} - xmodule_scss_path = resource_filename(__name__, "") + "/css/" - - for class_ in classes: - class_css = getattr(class_, css_attribute)() - rel_fragment_paths = [] - for fragment_path in class_css.get('scss', []): - rel_fragment_path = fragment_path.split(xmodule_scss_path)[1] - rel_fragment_paths.append(rel_fragment_path) - - module_styles_lines = [] - module_styles_lines.append("""{selector}.xmodule_{class_.__name__} {{""".format( - class_=class_, selector=selector - )) - module_styles_lines.extend(f' @import "{path}";' for path in rel_fragment_paths) - module_styles_lines.append('}') - - contents[f"{class_.__name__}{suffix}.scss"] = '\n'.join(module_styles_lines) - - _write_files(output_root, contents) - - def _write_js(output_root, classes, js_attribute): """ Write the javascript fragments from all XModules in `classes` @@ -294,9 +245,7 @@ def main(): root = path(args['']) descriptor_files = write_descriptor_js(root / 'descriptors/js') - write_descriptor_styles(root / 'descriptors/scss') module_files = write_module_js(root / 'modules/js') - write_module_styles(root / 'modules/scss') write_webpack(root / 'webpack.xmodule.config.js', module_files, descriptor_files) diff --git a/xmodule/template_block.py b/xmodule/template_block.py index 71b2c21f1441..abf1f2c725a9 100644 --- a/xmodule/template_block.py +++ b/xmodule/template_block.py @@ -69,16 +69,10 @@ class CustomTagBlock(CustomTagTemplateBlock): # pylint: disable=abstract-method 'js': [], 'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js'), } - preview_view_css = { - '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')], - } def studio_view(self, _context): """ diff --git a/xmodule/word_cloud_block.py b/xmodule/word_cloud_block.py index d7d35dedc5f3..8fe741b881db 100644 --- a/xmodule/word_cloud_block.py +++ b/xmodule/word_cloud_block.py @@ -118,11 +118,6 @@ class WordCloudBlock( # pylint: disable=abstract-method ], 'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js'), } - preview_view_css = { - 'scss': [ - resource_filename(__name__, 'css/word_cloud/display.scss'), - ], - } studio_view_js = { 'js': [ @@ -130,9 +125,6 @@ class WordCloudBlock( # pylint: disable=abstract-method ], 'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js'), } - studio_view_css = { - 'scss': [], - } studio_js_module_name = "MetadataOnlyEditingDescriptor" mako_template = "widgets/metadata-only-edit.html" diff --git a/xmodule/x_module.py b/xmodule/x_module.py index c2e57a05988a..b1c8d5bfb07f 100644 --- a/xmodule/x_module.py +++ b/xmodule/x_module.py @@ -215,9 +215,6 @@ class HTMLSnippet: preview_view_js = {} studio_view_js = {} - preview_view_css = {} - studio_view_css = {} - @classmethod def get_preview_view_js(cls): return cls.preview_view_js @@ -234,14 +231,6 @@ def get_studio_view_js(cls): def get_studio_view_js_bundle_name(cls): return cls.__name__ + 'Studio' - @classmethod - def get_preview_view_css(cls): - return cls.preview_view_css - - @classmethod - def get_studio_view_css(cls): - return cls.studio_view_css - def get_html(self): """ Return the html used to display this snippet