I have added a similar js file to the cms but it is not loading in the cms static files and not getting applied to the iframes and the cms static file is not generated and added.
@sarina @mboisson @arbrandes
Moved to Site Operators category.
When making forums posts could you please specify which Open edX version you’re using @Sliver_Horizon ? Thank you.
openedx ulmo version and tutor 21 version
@indigo_maintanance @joel.edwards
Hi @Sliver_Horizon
Are you perhaps able to provide us any details about the changes you’ve made and how you applied them? If you can detail what you’ve tried I can attempt to reproduce it and see what’s happening.
Thanks
Created a js folder and created a copy of dark-theme.js in the cms and trying to load the js file in the cms iframes.
(
“openedx-common-assets-settings”,
“”"
javascript_files = [‘base_application’, ‘application’, ‘certificates_wv’, ‘base_vendor’]
dark_theme_filepath = [‘tot-custom-theme/js/dark-theme.js’]
for filename in javascript_files:
if filename in PIPELINE[‘JAVASCRIPT’]:
PIPELINE[‘JAVASCRIPT’][filename][‘source_filenames’] += dark_theme_filepath
“”",
),
Added this patch in the plugin.py in the indigo.
tried the images build openedx also tried with --no-cache.
Still the js file is not getting loaded in the cms.
@joel.edwards
The patch only added dark-theme.js to the LMS bundles (base_application, application, etc.). However, Studio/CMS does not always use the same bundle names, and in newer releases the base_application bundle may not exist at all. In that case, the JS was never included in the final CMS static assets, so the theme logic was not applied inside Studio iframes.
The following is the updated patch you can try.
hooks.Filters.ENV_PATCHES.add_items(
[
# for production
(
"openedx-common-assets-settings",
"""
dark_theme_filepath = ['indigo/js/dark-theme.js']
for filename in ['base_application', 'application', 'certificates_wv']:
if filename in PIPELINE['JAVASCRIPT']:
PIPELINE['JAVASCRIPT'][filename]['source_filenames'] += dark_theme_filepath
if 'base_application' not in PIPELINE['JAVASCRIPT'] and 'base_vendor' in PIPELINE['JAVASCRIPT']:
PIPELINE['JAVASCRIPT']['base_vendor']['source_filenames'] += dark_theme_filepath
""",
),
# for development
(
"openedx-lms-development-settings",
"""
javascript_files = ['base_application', 'application', 'certificates_wv']
dark_theme_filepath = ['indigo/js/dark-theme.js']
for filename in javascript_files:
if filename in PIPELINE['JAVASCRIPT']:
PIPELINE['JAVASCRIPT'][filename]['source_filenames'] += dark_theme_filepath
MFE_CONFIG['INDIGO_ENABLE_DARK_TOGGLE'] = {{ INDIGO_ENABLE_DARK_TOGGLE }}
MFE_CONFIG['INDIGO_FOOTER_NAV_LINKS'] = {{ INDIGO_FOOTER_NAV_LINKS }}
""",
),
(
"openedx-lms-production-settings",
"""
MFE_CONFIG['INDIGO_ENABLE_DARK_TOGGLE'] = {{ INDIGO_ENABLE_DARK_TOGGLE }}
MFE_CONFIG['INDIGO_FOOTER_NAV_LINKS'] = {{ INDIGO_FOOTER_NAV_LINKS }}
""",
),
(
"openedx-cms-common-settings",
"""
if 'base_vendor' in PIPELINE['JAVASCRIPT']:
PIPELINE['JAVASCRIPT']['base_vendor']['source_filenames'] += ['indigo/js/dark-theme.js']
""",
),
]
)