diff options
| author | Adam <[email protected]> | 2025-12-28 05:12:32 -0600 |
|---|---|---|
| committer | Adam <[email protected]> | 2025-12-28 05:12:36 -0600 |
| commit | 4a9ff9412e8daedc36319bd2ee8ca62d5aa52be7 (patch) | |
| tree | ad035366cdebc87d4eea75475201af3d11bd64ed /packages/app/script | |
| parent | d6db6ff198c4513ca5511ae49b03d4277bc21718 (diff) | |
| download | opencode-4a9ff9412e8daedc36319bd2ee8ca62d5aa52be7.tar.gz opencode-4a9ff9412e8daedc36319bd2ee8ca62d5aa52be7.zip | |
feat(desktop): themes
Diffstat (limited to 'packages/app/script')
| -rw-r--r-- | packages/app/script/inject-theme-preload.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/app/script/inject-theme-preload.ts b/packages/app/script/inject-theme-preload.ts new file mode 100644 index 000000000..511ab7a3b --- /dev/null +++ b/packages/app/script/inject-theme-preload.ts @@ -0,0 +1,18 @@ +/** + * Injects the theme preload script into index.html. + * Run this as part of the build process. + */ + +import { generatePreloadScript } from "@opencode-ai/ui/theme" + +const htmlPath = new URL("../index.html", import.meta.url).pathname +const html = await Bun.file(htmlPath).text() + +const script = generatePreloadScript() +const injectedHtml = html.replace( + /<script id="oc-theme-preload-script">\s*\/\* THEME_PRELOAD_SCRIPT \*\/\s*<\/script>/, + `<script id="oc-theme-preload-script">${script}</script>`, +) + +await Bun.write(htmlPath, injectedHtml) +console.log("Injected theme preload script into index.html") |
