We continue to explore new ways to theme the platform that would open opportunities for near real-time theming, simpler theming etc. There are two development on this front:
- Dynamically-loaded themes
We tested a new mechanism called module federation, to separate the theme code from the rest of the MFE so it can be plugged in dynamically. This opens up the possibility of getting a list of themes from an API and applying one of them dynamically. A demo of that can be seen here: https://modular.theming.prototypes.kshitij.dev/
The aim here in the short term would be to have a centrally hosted theme that is used by all MFEs. So it is possible to rebuild and upload a new theme to a central place like S3, and it will automatically be available everywhere. An ADR for this can be seen here: https://github.com/edx/edx-platform/pull/27193 - Uniform theming across edx-platform and MFEs
OpenCraft uses a system called simple theme (as described in the previous post). This system allows us to specify theme overrides via edx/confiuration ansible variables.
We’ve done some work to also convert this to a branding package. It works as both an edx-platform theme and a branding package allowing it to be installed once on the server, and then used by all MFEs installed on the same server. They use the same variables for theming, so you can get the same theme applied to both edx-platform and MFEs
It’s currently demonstrated here; https://branding-theming-sandbox.opencraft.hosting/ using an deliberately obnoxious theme.
Over time will refine this to improve consistency and reduce code duplication.