Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions plugins/tutor-contrib-paragon/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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://<LMS_HOST>/static/paragon/themes/theme-1.min.css

- **Development environment**
URLs point directly to the Paragon static service, for example:

.. code-block:: text

http://localhost:<PARAGON_STATIC_SERVER_PORT>/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
***************

Expand Down