build: commit builtinblocks Webpack config and stub out xmodule_assets (#32685)
The Webpack configuration file for built-in XBlock JS used to be generated at build time and git-ignored. It lived at common/static/xmodule/webpack.xmodule.config.js. It was generated because the JS that it referred to was also generated at build-time, and the filenames of those JS modules were not static. Now that its contents have been made entirely static [1], there is no reason we need to continue generating this Webpack configuration file. So, we check it into edx-platform under the name ./webpack.builtinblocks.config.js. We choose to put it in the repo's root directory because the paths contained in the config file are relative to the repo's root. This allows us to behead both the xmodule/static_content.py (`xmodule_assets`) script andthe `process_xmodule_assets` paver task, a major step in removing the need for Python in the edx-platform asset build [2]. It also allows us to delete the `HTMLSnippet` class and all associated attributes, which were exclusively used by xmodule/static_content.py.. We leave `xmodule_assets` and `process_xmodule_assets` in as stubs for now in order to avoid breaking external code (like Tutor) which calls Paver; the entire pavelib/assets.py function will be eventually removed soon anyway [3]. Further, to avoid extraneous refactoring, we keep one method of `HTMLSnippet` around on a few of its former subclasses: `get_html`. This method was originally part of the XModule framework; now, it is left over on a few classes as a simple internal helper method. References: 1. https://github.com/openedx/edx-platform/pull/32480 2. https://github.com/openedx/edx-platform/issues/31800 3. https://github.com/openedx/edx-platform/issues/31895 Part of: https://github.com/openedx/edx-platform/issues/32481
This commit is contained in:
@@ -8,8 +8,6 @@ import sys
|
||||
import textwrap
|
||||
from datetime import datetime
|
||||
|
||||
from pkg_resources import resource_filename
|
||||
|
||||
from django.conf import settings
|
||||
from fs.errors import ResourceNotFound
|
||||
from lxml import etree
|
||||
@@ -27,7 +25,6 @@ from xmodule.stringify import stringify_children
|
||||
from xmodule.util.misc import escape_html_characters
|
||||
from xmodule.util.builtin_assets import add_webpack_js_to_fragment, add_sass_to_fragment
|
||||
from xmodule.x_module import (
|
||||
HTMLSnippet,
|
||||
ResourceTemplates,
|
||||
shim_xmodule_js,
|
||||
XModuleMixin,
|
||||
@@ -47,7 +44,7 @@ _ = lambda text: text
|
||||
@XBlock.needs("user")
|
||||
class HtmlBlockMixin( # lint-amnesty, pylint: disable=abstract-method
|
||||
XmlMixin, EditingMixin,
|
||||
XModuleToXBlockMixin, HTMLSnippet, ResourceTemplates, XModuleMixin,
|
||||
XModuleToXBlockMixin, ResourceTemplates, XModuleMixin,
|
||||
):
|
||||
"""
|
||||
The HTML XBlock mixin.
|
||||
@@ -144,17 +141,6 @@ class HtmlBlockMixin( # lint-amnesty, pylint: disable=abstract-method
|
||||
shim_xmodule_js(fragment, 'HTMLEditingDescriptor')
|
||||
return fragment
|
||||
|
||||
preview_view_js = {
|
||||
'js': [
|
||||
resource_filename(__name__, 'js/src/html/display.js'),
|
||||
resource_filename(__name__, 'js/src/javascript_loader.js'),
|
||||
resource_filename(__name__, 'js/src/collapsible.js'),
|
||||
resource_filename(__name__, 'js/src/html/imageModal.js'),
|
||||
resource_filename(__name__, 'js/common_static/js/vendor/draggabilly.js'),
|
||||
],
|
||||
'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js'),
|
||||
}
|
||||
|
||||
uses_xmodule_styles_setup = True
|
||||
|
||||
mako_template = "widgets/html-edit.html"
|
||||
@@ -163,13 +149,6 @@ class HtmlBlockMixin( # lint-amnesty, pylint: disable=abstract-method
|
||||
template_dir_name = "html"
|
||||
show_in_read_only_mode = True
|
||||
|
||||
studio_view_js = {
|
||||
'js': [
|
||||
resource_filename(__name__, 'js/src/html/edit.js')
|
||||
],
|
||||
'xmodule_js': resource_filename(__name__, 'js/src/xmodule.js'),
|
||||
}
|
||||
|
||||
# VS[compat] TODO (cpennington): Delete this method once all fall 2012 course
|
||||
# are being edited in the cms
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user