Skip to content

Commit ccac8d4

Browse files
kdmccormickfeanil
andauthored
docs: Streamlined brand README (#48)
Co-authored-by: Feanil Patel <feanil@axim.org>
1 parent d4f3801 commit ccac8d4

1 file changed

Lines changed: 64 additions & 35 deletions

File tree

brand-sample/README.md

Lines changed: 64 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,71 @@
1010

1111
## Using this brand package
1212

13+
Here are 4 different approaches to using this brand package.
14+
1315
> [!IMPORTANT]
14-
> These instructions assume you have a [tutor](https://docs.tutor.edly.io/index.html) environment that supports design tokens
16+
> These instructions assume that you have an Open edX environment that supports design tokens:
1517
> * **Paragon >= 23**
16-
> * **Open edX "Teak" release or later (Tutor >= 20)**
17-
> * **Tutor >= 20**
18+
> * **Open edX "Teak" release or later**
19+
> * A provisioned Open edX dev environment, either:
20+
> * **Tutor >= 20**
21+
> * A "bare-metal" setup
22+
23+
### Local brand dev using Tutor + Tutor Paragon Plugin
24+
25+
This will allow you to hack on the brand, recompile it, and preview it in your local Tutor instance.
26+
27+
First, set up the [Tutor Paragon Plugin](https://github.com/openedx/openedx-tutor-plugins/tree/main/plugins/tutor-contrib-paragon), which will reproducibly compile and serve brands for you:
28+
29+
```bash
30+
# Install and enable the Tutor Paragon plugin.
31+
tutor plugins install https://github.com/openedx/openedx-tutor-plugins/tree/main/plugins/tutor-contrib-paragon
32+
tutor plugins enable paragon
1833

19-
## TODO
34+
# Build the paragon-builder image.
35+
# With this built, the 'tutor local do paragon-build-tokens' command becomes available.
36+
tutor images build paragon-builder
2037

21-
#### Using the [`jsdelivr`](https://www.jsdelivr.com/) CDN (Recommended)
38+
# Ensure MFE container is running if it isn't already.
39+
# The MFE image will serve the CSS that you compile with paragon-build-tokens.
40+
tutor dev start -d lms cms mfe
41+
```
42+
43+
Every time you edit a theme, you will need to copy it into your tutor root and re-run paragon-build-tokens. You can do so by running the following from the root of the sample-plugin repository:
2244

23-
1. Stop `tutor` (`tutor dev stop` or `tutor local stop`)
24-
2. Navigate to your local tutor plugins directory (`tutor plugins printroot`)
25-
3. Create a new `sample-jsdelivr.py` plugin file with the following content
45+
```bash
46+
tutor_root="$(tutor config printroot)"
47+
[ -n "$tutor_root" ] \
48+
&& rm -rf "$tutor_root/env/plugins/paragon/theme-sources/themes" \
49+
&& cp -r brand-sample/tokens/src/themes "$tutor_root/env/plugins/paragon/theme-sources" \
50+
&& tutor local do paragon-build-tokens \
51+
&& echo 'Compiled design tokens :)' \
52+
|| echo 'Could not copy design token sources into tutor environment :('
53+
```
54+
55+
Note: If you are having issues building the tokens, check the contents of the paragon plugin folder within your tutor root. It should look like this:
56+
57+
```bash
58+
tree "$(tutor config printroot)/env/plugins/paragon"
59+
├── [...]
60+
└── theme-sources
61+
└── themes
62+
└── light
63+
└── global
64+
└── color.json
65+
```
66+
67+
### Local brand dev without Tutor
68+
69+
TODO write this section
70+
71+
### jsdeliver + Tutor
72+
73+
*tutor-contrib-sample ships with this approach, for your convenience.*
74+
75+
This configures Tutor so that your frontend loads the brand-sample from the [`jsdelivr`](https://www.jsdelivr.com/) CDN. It assumes that the brand exists on GitHub. This does not support local brand development.
76+
77+
Add this to a tutor plugin, and then enable the plugin and restart tutor:
2678

2779
```py
2880
import json
@@ -51,31 +103,9 @@ hooks.Filters.ENV_PATCHES.add_item(
51103
)
52104
```
53105

54-
4. Enable the plugin (`tutor plugins enable sample-jsdelivr`)
55-
5. Start `tutor` (`tutor dev start lms cms mfe` or `tutor local start lms cms mfe`)
56-
57-
#### Using the [Tutor Paragon Plugin](https://github.com/openedx/openedx-tutor-plugins/tree/main/plugins/tutor-contrib-paragon) (Recommended)
58-
59-
1. [Install](https://github.com/openedx/openedx-tutor-plugins/tree/main/plugins/tutor-contrib-paragon#installation) and [enable](https://github.com/openedx/openedx-tutor-plugins/tree/main/plugins/tutor-contrib-paragon#enable-the-plugin) the Tutor Paragon Plugin (`tutor-contrib-paragon`)
60-
2. [Build](https://github.com/openedx/openedx-tutor-plugins/tree/main/plugins/tutor-contrib-paragon#build-the-paragon-image) the `paragon-builder` image.
61-
2. Navigate to your Tutor config directory (you can find this by running `tutor config printroot`)
62-
3. From your config directory, navigate to `env/plugins/paragon` (the full path on my dev machine is `~/.local/share/tutor-main/env/plugins/paragon`)
63-
4. You should see some directories in there, find the `theme-sources` directory.
64-
5. Place this theme's [`color.json` file](./tokens/src/themes/light/global/color.json) in the appropriate subdirectory of the `theme-sources` directory.
65-
```sh
66-
$ tree ~/.local/share/tutor-main/env/plugins/paragon
67-
├── [...]
68-
└── theme-sources
69-
└── themes
70-
└── light
71-
└── global
72-
└── color.json
73-
```
74-
6. [Build](https://github.com/openedx/openedx-tutor-plugins/tree/main/plugins/tutor-contrib-paragon#build-all-themes) the theme
75-
7. Start `tutor` (`tutor dev start lms cms mfe` or `tutor local start lms cms mfe`)
106+
### jsdeliver without Tutor
76107

77-
### ***OR*** manually add to an MFE's `env.config.js(x)`
78-
Minimal `env.config.js` to install this theme
108+
Within each MFE, configure its `env.config.js[x]` to install this theme:
79109

80110
```js
81111
const config = {
@@ -94,8 +124,7 @@ const config = {
94124
export default config;
95125
```
96126

97-
### ***OR*** manually add to a `frontend-base` site's `site.config.tsx`
98-
Add the following block to your `SiteConfig` object in `site.config.tsx`
127+
If you are running a frontend-base site, add to the `SiteConfig` object in your `site.config.ts[x]`:
99128

100129
```tsx
101130
const siteConfig: SiteConfig = {
@@ -109,4 +138,4 @@ const siteConfig: SiteConfig = {
109138
},
110139
[...]
111140
}
112-
```
141+
```

0 commit comments

Comments
 (0)