diff --git a/plugins/tutor-contrib-paragon/README.rst b/plugins/tutor-contrib-paragon/README.rst index 85e0f23..fe616ee 100644 --- a/plugins/tutor-contrib-paragon/README.rst +++ b/plugins/tutor-contrib-paragon/README.rst @@ -123,6 +123,88 @@ Output Artifacts will be written to the directory specified by ``PARAGON_COMPILED_THEMES_PATH`` (default: ``env/plugins/paragon/compiled-themes``). + +Hosting Compiled Themes +*********************** + +The Paragon plugin for Tutor can serve compiled themes directly. +To enable automatic static hosting, set: + +.. code-block:: text + + PARAGON_SERVE_COMPILED_THEMES = true + +This adds an Nginx service to your Tutor instance, which hosts themes from the path defined by `PARAGON_COMPILED_THEMES_PATH`. +Additionally, it injects URLs into the LMS configuration under the `PARAGON_THEME_URLS` setting. + +Note + The Nginx server only serves the minified CSS files (`*.min.css`) generated by the build tokens job. + +Local and Development URLs +-------------------------- + +Because local and development environments handle static files differently, the plugin adjusts URLs based on context: + +- **Local environment** + URLs will reference the LMS service and be redirected via Caddy, for example: + + .. code-block:: text + + http:///static/paragon/themes/theme-1.min.css + +- **Development environment** + URLs point directly to the Paragon static service, for example: + + .. code-block:: text + + http://localhost:/themes/theme-1.min.css + +Each theme listed in `PARAGON_ENABLED_THEMES` is automatically added to the `PARAGON_THEME_URLS` setting in the LMS, making them accessible for use in Open edX MFEs. +If no themes are enabled, the plugin falls back to the default Paragon light theme. + +Paragon Theme URLs Structure +---------------------------- + +The `PARAGON_THEME_URLS` setting added to the LMS `MFE_CONFIG` dictionary follows this structure: + +.. code-block:: python + + MFE_CONFIG["PARAGON_THEME_URLS"] = { + "core": { + "urls": { + "default": "http://local.openedx.io/static/paragon/core/core.min.css" + }, + }, + "defaults": { + "light": "light", + }, + "variants": { + "light": { + "urls": { + "default": "http://local.openedx.io/static/paragon/themes/light/light.min.css" + } + }, + "green": { + "urls": { + "default": "http://local.openedx.io/static/paragon/themes/green/green.min.css" + } + }, + ... + } + } + +- The **`core`** section must always be present. Ensure the core folder is compiled to provide base styles used across all themes. If the core folder is not provided, the plugin will use the Paragon defaults. +- The **`variants`** key includes all compiled themes. Each theme will appear here automatically if it's listed in `PARAGON_ENABLED_THEMES`. +- To change the default theme used under a mode (e.g., `light`), edit the `defaults` section. For example, to use the `green` theme as the default: + + .. code-block:: python + + "defaults": { + "light": "green", + } + +This configuration enables flexible theme switching and safe defaults across multiple MFEs. + Troubleshooting ***************