Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit a02146d

Browse files
committed
server: Fix loading of code block theme on server builds
1 parent a638555 commit a02146d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/services/code_block_theme.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ import fs from "fs";
88
import themeNames from "./code_block_theme_names.json" with { type: "json" }
99
import { t } from "i18next";
1010
import { join } from "path";
11-
import { getResourceDir } from "./utils.js";
12-
import env from "./env.js";
11+
import utils from "./utils.js";
1312

1413
/**
1514
* Represents a color scheme for the code block syntax highlight.
@@ -31,8 +30,8 @@ interface ColorTheme {
3130
* @returns the supported themes, grouped.
3231
*/
3332
export function listSyntaxHighlightingThemes() {
34-
const stylesDir = (env.isDev() ? "node_modules/@highlightjs/cdn-assets/styles" : "styles");
35-
const path = join(getResourceDir(), stylesDir);
33+
const stylesDir = (!utils.isElectron() ? "node_modules/@highlightjs/cdn-assets/styles" : "styles");
34+
const path = join(utils.getResourceDir(), stylesDir);
3635
const systemThemes = readThemesFromFileSystem(path);
3736

3837
return {

src/services/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,5 +364,6 @@ export default {
364364
normalize,
365365
hashedBlobId,
366366
toMap,
367-
isString
367+
isString,
368+
getResourceDir
368369
};

0 commit comments

Comments
 (0)