Working with the following configuration:
- Tutor Maple Release (13.3.1)
- Tutor Indigo (commits right before v14.0.0 tag)
We’re trying to serve multiple site themes from one installation of Open edX platform and we’re wondering if we should have separate tutor plugins (based on tutor-indigo) for the different site themes or should we just put all themes in separate directory located within the tutor-indigo
plugin located at tutor-indigo/tutorindigo/templates at v14.0.0 · overhangio/tutor-indigo · GitHub directory?
To make this happen we’ve done both ways below:
- Put all site themes in tutor-indigo/tutorindigo/templates at v14.0.0 · overhangio/tutor-indigo · GitHub directory separated directories (e.g. indigo, theme1, theme2)
- Make separate tutor plugins for
tutor-theme1
andtutor-theme2
based ontutor-indigo
theme.
Copying Theme Files to Tutor Environment
To make sure that we copy files to the Tutor environment we update this code tutor-indigo/plugin.py at v14.0.0 · overhangio/tutor-indigo · GitHub
To push out the theme files to the tutor environment at /Users/<username>/Library/Application Support/tutor/env/build/openedx/themes
we issue the following command.
(venv)<username>@000-127-116-182 tutor % tutor config save
Configuration saved to /Users/<username>/Library/Application Support/tutor/config.yml
Environment generated in /Users/<username>/Library/Application Support/tutor/env
# /Users/<username>/Library/Application Support/tutor-plugins/tutor-indigo/tutorindigo/plugins.py
# Outputs to tutor environment at env/build/openedx/themes/indigo/ directory
hooks.Filters.ENV_TEMPLATE_TARGETS.add_items(
[
("indigo", "build/openedx/themes"),
],
)
# /Users/<username>/Library/Application Support/tutor-plugins/tutor-theme1/tutortheme1/plugins.py
# Outputs to tutor environment at env/build/openedx/themes/theme1/ directory
hooks.Filters.ENV_TEMPLATE_TARGETS.add_items(
[
("theme1", "build/openedx/themes"),
],
)
# /Users/<username>/Library/Application Support/tutor-plugins/tutor-theme2/tutortheme2/plugins.py
# Outputs to tutor environment at env/build/openedx/themes/theme2/ directory
hooks.Filters.ENV_TEMPLATE_TARGETS.add_items(
[
("theme2", "build/openedx/themes"),
],
)
This configuration copies the theme files out to the tutor environment at /Users//Library/Application Support/tutor/env/build/openedx/themes.
SASS Compiling
To make this push out SASS files we add this additional Tutor configuration under ./tutor-theme/tutortheme/plugin.py
.
# Copy the SCSS partial files over to the tutor env. It appears this partials directory is
# ignored by default by tutor/env.py `ENV_PATTERNS_IGNORE`.
hooks.Filters.ENV_PATTERNS_INCLUDE.add_items(
[
# Include files from "partials" folders
r"(.*/)?partials(/.*)?$",
]
)
Show in the image below we have the SCSS files coming across into the tutor environment at /Users/<username>/Library/Application Support/tutor/env/build/openedx/themes
, however, the watchtheme
only finds SCSS files in the indigo
theme to recompile.
We’re noticing that the watchthemes
container is only compiling SASS for the indigo
theme.
Here is the log file for the watchthemes
container.
Recompiling indigo theme for lms
rtlcss /openedx/themes/indigo/lms/static/css/discussion/lms-discussion-bootstrap.css /openedx/themes/indigo/lms/static/css/discussion/lms-discussion-bootstrap-rtl.css
rtlcss: Warning! No config present, using defaults.
Saving: /openedx/themes/indigo/lms/static/css/discussion/lms-discussion-bootstrap-rtl.css
rtlcss /openedx/themes/indigo/lms/static/css/bootstrap/lms-main.css /openedx/themes/indigo/lms/static/css/bootstrap/lms-main-rtl.css
rtlcss: Warning! No config present, using defaults.
Saving: /openedx/themes/indigo/lms/static/css/bootstrap/lms-main-rtl.css
Sass dir '/openedx/themes/indigo/lms/static/certificates/sass' does not exists, skipping sass compilation for '/openedx/themes/indigo'
Done recompiling indigo theme for lms