99>
1010> Information on the design tokens project:
1111>
12- > - < https://github.com/openedx/paragon/blob/master /docs/decisions/0019-scaling-styles-with-design-tokens.rst >
13- > - < https://github.com/openedx/paragon/tree/alpha ?tab=readme-ov-file#design-tokens >
12+ > - < https://github.com/openedx/paragon/blob/release-23.x /docs/decisions/0019-scaling-styles-with-design-tokens.rst >
13+ > - < https://github.com/openedx/paragon/tree/release-23.x ?tab=readme-ov-file#design-tokens >
1414
1515## Overview
1616
@@ -19,19 +19,20 @@ theming with Paragon by loading branded CSS externally (e.g., from a CDN).
1919
2020To do this, configured URLs pointing to relevant CSS files from
2121` @openedx/brand-openedx ` are loaded and injected to the HTML document at
22- runtime. This differs from importing the styles from ` @openedx/brand-openedx `
23- directly, which includes these styles in the application's production assets.
22+ runtime. This differs from the deprecated method of importing the styles from
23+ ` @openedx/brand-openedx ` directly, which includes these styles in the
24+ application's production assets.
2425
2526This override mechanism works by compiling the design tokens defined in
2627` @openedx/brand-openedx ` with the core Paragon tokens to generate overrides to
2728Paragon's default CSS variables and then compiling the output CSS with any SCSS
2829theme customizations not possible through a design token override.
2930
3031The CSS urls for ` @openedx/brand-openedx ` overrides will be applied after the
31- core Paragon theme urls load, thus overriding any previously set CSS variables
32+ Paragon base styles load, thus overriding any previously set CSS variables
3233and/or styles.
3334
34- By serving brand CSS loaded externally, consuming applications of Paragon no
35+ By loading a theme's CSS externally, consuming applications of Paragon no
3536longer need to be responsible for compiling the brand SCSS to CSS themselves
3637and instead use a pre-compiled CSS file. In doing so, this allows making
3738changes to the site theme without needing to necessarily re-build and re-deploy
@@ -68,51 +69,42 @@ supports having multiple or alternative `light` and/or `dark` theme variants.
6869You can see the [ Configuration options] ( #configuration-options ) example for
6970better understanding.
7071
71- ## Technical architecture
72-
73- ![ overview of paragon theme loader] ( ./images/paragon-theme-loader.png " Paragon theme loader ")
74-
7572## Development
7673
7774### Configuration options
7875
79- To enable ` @openedx/brand-openedx ` overrides, the ` paragonThemeUrls ` site
76+ To enable ` @openedx/brand-openedx ` overrides, the ` theme ` site
8077configuration setting may be configured with the following:
8178
8279| Property | Data Type | Description |
8380| ----------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------- |
8481| ` core ` | Object | Metadata about the core styles from ` @openedx/brand-openedx ` . |
85- | ` core.urls ` | Object | URL(s) for the ` core.css ` files from ` @openedx/brand-openedx ` . |
86- | ` core.urls.brandOverride ` | String | URL for the ` core.css ` file from ` @openedx/brand-openedx ` . |
82+ | ` core.url ` | String | URL for the ` core.css ` file from ` @openedx/brand-openedx ` . |
8783| ` defaults ` | Object | Mapping of theme variants to Paragon's default supported light and dark theme variants. |
8884| ` defaults.light ` | String | Default ` light ` theme variant from the theme variants in the ` variants ` object. |
8985| ` defaults.dark ` | String | Default ` dark ` theme variant from the theme variants in the ` variants ` object. |
9086| ` variants ` | Object | Metadata about each supported theme variant. |
9187| ` variants.light ` | Object | Metadata about the light theme variant styles from ` @openedx/brand-openedx ` . |
92- | ` variants.light.urls ` | Object | URL(s) for the ` light.css ` files from ` @openedx/brand-openedx ` . |
93- | ` variants.light.urls.brandOverride ` | String | URL for the ` light.css ` file from ` @openedx/brand-openedx ` . |
88+ | ` variants.light.url ` | String | URL for the ` light.css ` file from ` @openedx/brand-openedx ` . |
9489| ` variants.dark ` | Object | Metadata about the dark theme variant styles from ` @openedx/brand-openedx ` . |
95- | ` variants.dark.urls ` | Object | URL(s) for the ` dark.css ` files from ` @openedx/brand-openedx ` . |
96- | ` variants.dark.urls.brandOverride ` | String | URL for the ` dark.css ` file from ` @openedx/brand-openedx ` . |
90+ | ` variants.dark.url ` | String | URL for the ` dark.css ` file from ` @openedx/brand-openedx ` . |
9791
98- The ` dark ` theme variant options are optional.
92+ The ` dark ` theme variant is optional.
9993
10094A simple example:
10195
10296``` ts
10397const siteConfig: SiteConfig = {
104- paragonThemeUrls : {
98+ theme : {
10599 core: {
106- urls: {
107- brandOverride:
" https://cdn.jsdelivr.net/npm/@my-brand/[email protected] /dist/core.min.css" ,
108- },
100+ url:
" https://cdn.jsdelivr.net/npm/@my-org/[email protected] /dist/core.min.css" ,
109101 },
110102 defaults: {
111103 light: " light" ,
112104 },
113105 variants: {
114106 light: {
115- brandOverride :
" https://cdn.jsdelivr.net/npm/@my-brand/brand [email protected] /dist/light.min.css" ,
107+ url :
" https://cdn.jsdelivr.net/npm/@my-org/theme [email protected] /dist/light.min.css" ,
116108 },
117109 },
118110 },
@@ -125,41 +117,29 @@ A complete example, including custom variants:
125117const siteConfig: SiteConfig = {
126118 paragonThemeUrls: {
127119 core: {
128- urls: {
129- brandOverride
: " https://cdn.jsdelivr.net/npm/@my-brand/[email protected] /dist/core.min.css" ,
130- },
120+ url
: " https://cdn.jsdelivr.net/npm/@my-org/[email protected] /dist/core.min.css" ,
131121 },
132122 defaults: {
133123 light: " light" ,
134124 dark: " dark" ,
135125 },
136126 variants: {
137127 light: {
138- urls: {
139- brandOverride
: " https://cdn.jsdelivr.net/npm/@my-brand/[email protected] /dist/light.min.css" ,
140- },
128+ url
: " https://cdn.jsdelivr.net/npm/@my-org/[email protected] /dist/light.min.css" ,
141129 },
142- // Configure optional dark mode
130+ // Optional dark mode
143131 dark: {
144- urls: {
145- brandOverride
: " https://cdn.jsdelivr.net/npm/@my-brand/[email protected] /dist/dark.min.css" ,
146- },
132+ url
: " https://cdn.jsdelivr.net/npm/@my-org/[email protected] /dist/dark.min.css" ,
147133 },
148134 // Configure any extra theme using a custom @openedx/brand-openedx package
149135 green: {
150- urls: {
151- brandOverride
: " https://cdn.jsdelivr.net/npm/@my-brand/[email protected] /dist/green.min.css" ,
152- },
136+ url
: " https://cdn.jsdelivr.net/npm/@my-org/[email protected] /dist/green.min.css" ,
153137 },
154138 red: {
155- urls: {
156- brandOverride
: " https://cdn.jsdelivr.net/npm/@my-brand/[email protected] /dist/red.min.css" ,
157- },
139+ url
: " https://cdn.jsdelivr.net/npm/@my-org/[email protected] /dist/red.min.css" ,
158140 },
159141 " high-contrast-dark" : {
160- urls: {
161- brandOverride
: " https://cdn.jsdelivr.net/npm/@my-brand/[email protected] /dist/high-contrast-dark.min.css" ,
162- },
142+ url
: " https://cdn.jsdelivr.net/npm/@my-org/[email protected] /dist/high-contrast-dark.min.css" ,
163143 },
164144 },
165145 },
0 commit comments