Skip to content

Commit 8aae940

Browse files
authored
docs: Update README.rst to reflect latest plugin configuration and structure
This commit updates the Tutor Paragon Plugin documentation to align with recent code changes and the approach outlined in the original proposal.
1 parent 310ed54 commit 8aae940

File tree

1 file changed

+69
-195
lines changed

1 file changed

+69
-195
lines changed

plugins/tutor-contrib-paragon/README.rst

Lines changed: 69 additions & 195 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Tutor Paragon Plugin
55
#####################
66

7-
.. contents:: Tabla de Contenidos
7+
.. contents:: Table of Contents
88
:local:
99

1010
Introduction
@@ -13,56 +13,58 @@ Introduction
1313
What is the Tutor Paragon Plugin?
1414
---------------------------------
1515

16-
The Tutor Paragon Plugin (``tutor-contrib-paragon``) enables developers and operators to compile design tokens into CSS themes using the Paragon CLI and serve those themes to Open edX Micro-Frontends (MFEs) via Tutor.
16+
The **Tutor Paragon Plugin** (`tutor-contrib-paragon`) enables developers and operators to compile Paragon design tokens into CSS themes using the Paragon CLI and serve those themes to Open edX Micro-Frontends (MFEs) via Tutor.
1717

18-
This plugin introduces a wrapper around the Paragon CLI build process, managing token source directories and output paths, and exposing compiled themes through Tutor's static hosting infrastructure.
18+
It wraps the Paragon CLI build process, manages token source directories and output paths, and exposes compiled themes through Tutor's static hosting infrastructure.
1919

2020
What problem does it solve?
2121
---------------------------
2222

23-
This plugin simplifies the theme customization process across MFEs by:
23+
This plugin simplifies MFE theme customization by:
2424

25-
* Standardizing how Paragon tokens are compiled.
26-
* Automatically placing output files in a consistent, hostable location.
27-
* Enabling static delivery of CSS files for MFE consumption.
28-
* Allowing tenant-based theme overrides with flexible configuration.
25+
* Standardizing how Paragon tokens are compiled.
26+
* Automatically placing output files in a consistent, hostable location.
27+
* Enabling static delivery of CSS files for MFE consumption.
28+
* Supporting tenant-based theme overrides with flexible configuration.
2929

3030
Target Audience
3131
---------------
3232

33-
* Open edX developers customizing MFE themes.
34-
* Operators managing theming at scale.
35-
* Designers experimenting with visual tokens in real-time environments.
33+
* Open edX developers customizing MFE themes.
34+
* Operators managing theming at scale.
35+
* Designers experimenting with visual tokens in real-time environments.
3636

3737
Prerequisites
3838
=============
3939

40-
* Working Tutor environment with Docker.
41-
* Familiarity with Paragon design tokens and MFE architecture.
42-
* Basic understanding of Tutor plugin system and configuration management.
40+
* A working Tutor environment with Docker.
41+
* Familiarity with Paragon design tokens and MFE architecture.
42+
* Basic understanding of Tutor’s plugin system and configuration management.
43+
* Tutor Plugin MFE installed and enabled.
44+
4345

4446
Version Compatibility
4547
=====================
4648

47-
To use the Tutor Paragon Plugin, ensure you are running compatible versions of the Open edX platform and its dependencies:
49+
To use this plugin, ensure you're running compatible versions of Open edX and its dependencies:
4850

4951
* **Paragon 23+**
5052
* **Open edX "Teak" release (or Tutor 20+)**
5153
* **Tutor 20+**
5254

5355
.. note::
54-
Design tokens functionality, which this plugin relies on, is available starting from Paragon version 23 and the Open edX "Teak" release (which corresponds to Tutor version 20). Using this plugin with earlier versions may result in compatibility issues or missing features.
56+
Design token functionality is available starting from Paragon 23 and Open edX "Teak". Earlier versions may not be compatible.
5557

5658
Installation
5759
============
5860

5961
.. note::
60-
A future version of this plugin may be available for installation via PyPI. For now, please use the development installation method below.
62+
A future version may be available via PyPI. For now, use the development installation method.
6163

6264
Development Install
6365
-------------------
6466

65-
Clone the repo and install in editable mode:
67+
Clone the repository and install in editable mode:
6668

6769
.. code-block:: bash
6870
@@ -82,23 +84,16 @@ Use Tutor to enable the plugin:
8284
Verify Installation
8385
-------------------
8486

85-
You should see something like:
86-
87-
.. code-block:: text
88-
89-
paragon enabled
90-
91-
If the plugin appears as 'enabled', it's ready to use.
92-
Ensure the plugin is listed in Tutor:
87+
Check that the plugin is listed and enabled:
9388

9489
.. code-block:: bash
9590
96-
tutor plugins list
91+
tutor plugins list | grep paragon
9792
9893
Build the Paragon Image
9994
-----------------------
10095

101-
Before compiling tokens, build the image used by the plugin:
96+
Before compiling tokens, build the Docker image used by the plugin:
10297

10398
.. code-block:: bash
10499
@@ -112,221 +107,100 @@ Core Plugin Settings
112107

113108
All configuration variables are defined via Tutor:
114109

115-
* ``PARAGON_THEME_SOURCES_PATH``: Location of your token input folders.
116-
* ``PARAGON_COMPILED_THEMES_PATH``: Output folder for generated CSS.
117-
* ``PARAGON_ENABLED_THEMES``: List of themes to compile.
118-
* ``PARAGON_SERVE_COMPILED_THEMES``: Whether to host the compiled files.
110+
+----------------------------+--------------------------------------------------------------+-------------------------------+
111+
| Variable | Description | Default Value |
112+
+============================+==============================================================+===============================+
113+
| `PARAGON_THEMES_PATH` | Base path for theme sources and compiled output | `env/plugins/paragon/themes` |
114+
+----------------------------+--------------------------------------------------------------+-------------------------------+
115+
| `PARAGON_THEMES` | List of theme folders to compile and serve | `['light', 'dark']` |
116+
+----------------------------+--------------------------------------------------------------+-------------------------------+
117+
| `MFE_HOST_EXTRA_FILES` | Whether to serve compiled themes via Tutor’s MFE web server | `true` |
118+
+----------------------------+--------------------------------------------------------------+-------------------------------+
119119

120120
Sample Configuration
121121
--------------------
122122

123123
.. code-block:: yaml
124124
125-
PARAGON_THEME_SOURCES_PATH: "{{ TUTOR_ROOT }}/env/plugins/paragon/theme-sources"
126-
PARAGON_COMPILED_THEMES_PATH: "{{ TUTOR_ROOT }}/env/plugins/paragon/compiled-themes"
127-
PARAGON_ENABLED_THEMES:
125+
PARAGON_THEMES_PATH: "{{ TUTOR_ROOT }}/env/plugins/paragon/themes"
126+
PARAGON_THEMES:
128127
- light
129128
- dark
130-
PARAGON_SERVE_COMPILED_THEMES: true
129+
MFE_HOST_EXTRA_FILES: true
131130
132131
Theme Directory Structure
133132
-------------------------
134133

135134
.. code-block:: text
136135
137-
theme-sources/
138-
├── core/
139-
│ └── base tokens
140-
└── themes/
141-
├── light/
142-
└── dark/
136+
{{ TUTOR_ROOT }}/env/plugins/paragon/themes/
137+
├── core/ # Shared base design tokens
138+
├── light/ # Light theme tokens
139+
└── dark/ # Dark theme tokens
143140
144-
The ``core`` directory contains shared design tokens. Each theme in ``themes/`` is compiled into separate CSS files.
141+
Only themes listed in `PARAGON_THEMES` will be compiled and served. The `core/` directory is required and provides base styles shared across all themes.
145142

146143
Usage
147144
=====
148145

149-
Compiling Themes
146+
Build All Themes
150147
----------------
151148

152-
This plugin wraps the ``npx paragon build-tokens`` command. To compile themes:
149+
To compile all themes listed in `PARAGON_THEMES`:
153150

154151
.. code-block:: bash
155152
156153
tutor local do paragon-build-tokens
157154
158-
By default, it uses the themes defined in ``PARAGON_ENABLED_THEMES``.
155+
Build Specific Themes
156+
---------------------
159157

160-
Options
161-
-------
158+
To compile only selected themes:
162159

163-
The Tutor Paragon plugin acts as a wrapper for the Paragon CLI. It forwards any flags or options you provide directly to the underlying ``paragon build-tokens`` command. This means you can use all the options available in the `Paragon CLI documentation <https://github.com/openedx/paragon>`_.
164-
165-
Common options include:
160+
.. code-block:: bash
166161
167-
* ``--themes``: comma-separated list of themes to compile.
168-
* ``--paragon-option``: pass any custom flag to Paragon CLI.
162+
tutor local do paragon-build-tokens --themes light,dark
169163
170-
For a complete list of available flags and their descriptions, please refer to the `Paragon CLI documentation <https://github.com/openedx/paragon>`_.
164+
Pass Additional CLI Options
165+
---------------------------
171166

172-
Examples
173-
--------
167+
You can pass extra options to the Paragon CLI:
174168

175169
.. code-block:: bash
176170
177-
tutor local do paragon-build-tokens --themes light,dark
171+
tutor local do paragon-build-tokens --paragon-option value
178172
179173
Output
180174
------
181175

182-
CSS files will be placed in:
183-
184-
``{{ TUTOR_ROOT }}/env/plugins/paragon/compiled-themes/<theme>/theme.css``
185-
186-
These are served statically when ``PARAGON_SERVE_COMPILED_THEMES`` is enabled.
187-
188-
.. note::
189-
190-
If no themes are configured, the plugin falls back to Paragon's built-in light theme.
191-
192-
Integration with MFEs
193-
=====================
194-
195-
Serving CSS Themes
196-
------------------
197-
198-
.. note::
199-
200-
The plugin hosts only the **minified versions** of the CSS files generated by Paragon. These files have the ``.min.css`` extension (e.g., ``<theme-name>.min.css``).
201-
202-
In development, use localhost directly because there is no reverse proxy:
203-
204-
``http://localhost:8000/static/paragon/<theme>.min.css``
205-
206-
In production, the LMS and Caddy proxy handle requests automatically, so the files are served at:
207-
208-
``https://<LMS_DOMAIN>/static/paragon/<theme>.min.css``
209-
210-
Compiled themes are available at:
211-
212-
* **Development:** ``http://localhost:8000/static/paragon/<theme>.min.css``
213-
* **Production:** ``<LMS_URL>/static/paragon/<theme>.min.css``
214-
215-
Using in MFEs
216-
-------------
217-
218-
Include the CSS link in your MFE HTML shell:
219-
220-
.. code-block:: html
221-
222-
<link rel="stylesheet" href="/static/paragon/light.min.css" />
223-
224-
Multi-Tenant Support
225-
--------------------
226-
227-
The plugin is designed to support multi-tenant environments. The core configuration can be overridden on a per-tenant basis, allowing for different themes to be served to different tenants. Specific integration details with tenant management systems (like ``eox-tenant``) will be documented separately.
228-
229-
Testing and Validation
230-
======================
231-
232-
To verify that everything works:
233-
234-
1. Build tokens: ``tutor local do paragon-build-tokens``
235-
2. Start the environment: ``tutor local start -d``
236-
3. Open the URL: ``http://localhost:8000/static/paragon/light.min.css``
237-
4. If the CSS loads in the browser, hosting is working correctly.
238-
239-
Verify Output
240-
-------------
241-
242-
After building, check this directory:
176+
Compiled CSS files (minified `.min.css`) are written to:
177+
{{ TUTOR_ROOT }}/env/plugins/paragon/themes/<theme>/<theme>.min.css
243178

244-
.. code-block:: bash
245-
246-
ls {{ TUTOR_ROOT }}/env/plugins/paragon/compiled-themes/
179+
Static Hosting
180+
==============
247181

248-
You should see:
182+
If `MFE_HOST_EXTRA_FILES` is set to `true`, the plugin:
249183

250-
* ``core.css``
251-
* ``<theme>.min.css``
184+
* Leverages the static file hosting capability provided by the `tutor-mfe` plugin to serve the compiled CSS files.
185+
* Makes the themes accessible via standard static URLs for use in LMS and MFEs.
252186

253-
Verbose Logging
254-
---------------
187+
Example URLs:
255188

256-
Run with:
257-
258-
.. code-block:: bash
189+
* Local LMS: `http://local.openedx.io/static/paragon/themes/light/light.min.css`
190+
* Dev server: `http://localhost:<PORT>/static/paragon/themes/dark/dark.min.css`
259191

260-
tutor local do paragon-build-tokens --verbose
192+
Each theme listed in `PARAGON_THEMES` is automatically exposed for use in MFEs.
261193

262194
Troubleshooting
263195
===============
264196

265-
No Custom Tokens Built
266-
----------------------
267-
268-
Check that the theme directory names match ``PARAGON_ENABLED_THEMES``. Paragon will fall back to its default theme if none are found.
269-
270-
Themes Not Compiled
271-
-------------------
272-
273-
Use ``--themes`` with no spaces:
274-
275-
.. code-block:: bash
276-
277-
tutor local do paragon-build-tokens --themes theme-1,theme-2
278-
279-
Permission Denied
280-
-----------------
281-
282-
Ensure Docker and Tutor can write to the paths.
283-
284-
"Expected at least 4 args" Error
285-
--------------------------------
286-
287-
Only run builds with:
288-
289-
.. code-block:: bash
290-
291-
tutor local do paragon-build-tokens
292-
293-
Contributing
294-
============
295-
296-
Repository
297-
----------
298-
299-
The main repository for this plugin is located at: https://github.com/openedx/openedx-tutor-plugins/tree/main/plugins/tutor-contrib-paragon
300-
301-
Local Development
302-
-----------------
303-
304-
Clone the repo and install in editable mode:
305-
306-
.. code-block:: bash
307-
308-
git clone https://github.com/openedx/openedx-tutor-plugins.git
309-
cd openedx-tutor-plugins/plugins/tutor-contrib-paragon
310-
pip install -e .
311-
312-
PR Process
313-
----------
314-
315-
1. Fork the repository.
316-
2. Create a feature branch.
317-
3. Submit a pull request.
318-
4. Follow project guidelines and include tests where applicable.
319-
320-
License and Credits
321-
===================
197+
* **Themes not compiled**: Ensure theme folders exist and match names in `PARAGON_THEMES`.
198+
* **Permission errors**: Verify Docker and Tutor have write access to the themes directory.
199+
* **Missing core tokens**: Ensure the `core/` folder exists and contains valid token files.
200+
* **Error: "Expected at least 4 args"**: Always run builds via `tutor local do`, not inside containers.
201+
* **Other issues**: Re-run with `--verbose` for detailed logs.
322202

323203
License
324-
-------
325-
326-
This plugin is licensed under the AGPLv3.
327-
328-
Credits
329-
-------
204+
=======
330205

331-
Developed by edunext, with inspiration from Tutor and Paragon tooling.
332-
For issues or support, open a GitHub issue or contact the maintainers.
206+
This software is licensed under the terms of the **AGPLv3**.

0 commit comments

Comments
 (0)