Context
After the effort to release version 23 of Paragon, which incorporates the use of design tokens via style-dictionary, and based on the information regarding the migration of MFEs to Paragon design tokens and CSS variables (detailed in the link Migrating MFEs to Paragon design tokens and CSS variables), the need arose to make this process more “user-friendly” for those working with the Tutor tool (overhangio/tutor). The goal is to streamline the workflow and ensure a smoother transition to the new design token structure.
Summary
The proposed solution involves designing a plugin, tentatively named tutor-paragon-plugin, which will integrate a simplified version of the existing build-tokens command from the openedx/paragon (Releases · openedx/paragon). The plugin will primarily use the following options: source (to specify the source directory for design tokens) and themes (to select which themes to include in the token build). The build directory will always be fixed to a specific path, where Tutor will serve the generated files, typically in the directory tutor/data/paragon/themes/<theme_name>/*.css.
The second part of the proposal involves modifying the behavior of Tutor from the plugin. The first change is the addition of a flag to define whether the files should be served by Tutor. If enabled, Tutor will update its Caddy configuration to serve the generated files and include the theme folder in the corresponding images. Furthermore, if a theme named “default” exists, the paths to that theme will default to the values specified in the PARAGON_THEME_URLS settings.
Approach
Generating Style Files
A Tutor plugin named tutor-paragon-plugin would be developed, providing a build-tokens command that internally executes Paragon’s npx build-tokens.
The command, paragon build-tokens --source ./<<folder_with_tokens>> --build-dir ./<<TUTOR_ROOT>>/data/paragon --themes theme1 theme2 light, would be used with the following parameters:
- –source: The directory where the design tokens are located for the build process.
- –themes: A list of themes to be included in the build.
- –build-dir: This will always point to <<TUTOR_ROOT>>/data/paragon/ for consistency in file storage.
- –source-tokens-only: Include only source design tokens in the build.
The users will be able to pass the values either through the command line or by defining them in the Tutor configuration file.
PARAGON_THEMES_PATH = “<
Implementing the build-tokens command
To integrate the build-tokens command into the Tutor plugin, which will execute the Paragon command (a Node.js package), two approaches are presented: subprocess and Docker
- Docker
Advantages: Isolation and consistency of the environment.
- Subprocess: The Paragon command is executed directly from Python using the subprocess module.
Advantages: Simple and no additional infrastructure needed.
Disadvantages: Depends on Node.js and Paragon being properly installed in the environment.
Hosting the Files
A flag will be added in Tutor to define whether the files should be served locally. If enabled, Tutor will:
- Include the theme folder inside the Tutor LMS image.
- Add configurations in caddy to expose the static files (https://lms.site/static/paragon/…).
- paths to those themes will be the default values in PARAGON_THEME_URLS
Aquí tienes un posible “Call to Action” para agregar a tu discusión en la comunidad Open edX:
Call to Action
We would love to hear from the Open edX community to ensure that this plugin is built in the most effective and user-friendly way possible. Your feedback is crucial in shaping the approach and refining the implementation details.
To structure the discussion, we propose the following review cycles:
- First Feedback Cycle: Open until February 27, 2025. During this period, we will gather insights and suggestions from the community.
- Revision Phase: Based on the feedback received, we will make the necessary adjustments and refinements.
- Second Feedback Cycle: From March 7 to March 20, 2025, we will open another review phase to validate the changes and ensure the plugin meets the community’s needs.
Please share your thoughts, concerns, and suggestions in this discussion. We are especially interested in your opinions on:
- The approach to integrating the
build-tokens
command in Tutor. - The best way to handle file hosting and serving.
- Any additional features or modifications that would improve usability.
Your feedback will help us develop a solution that benefits the entire community. Looking forward to your input!