feat: guards to prevent compiling this on web
This commit is contained in:
parent
91e093a21d
commit
5bc24a5d78
|
@ -60,13 +60,12 @@ export async function toggle(isEnabled: boolean) {
|
||||||
async function initThemes() {
|
async function initThemes() {
|
||||||
themesStyle ??= createStyle("vencord-themes");
|
themesStyle ??= createStyle("vencord-themes");
|
||||||
|
|
||||||
const { themeLinks, enabledThemes, userCssVars } = Settings;
|
const { themeLinks, enabledThemes } = Settings;
|
||||||
|
|
||||||
const links: string[] = [...themeLinks];
|
const links: string[] = [...themeLinks];
|
||||||
|
|
||||||
if (IS_WEB) {
|
if (IS_WEB) {
|
||||||
// UserCSS handled separately
|
for (const theme of enabledThemes) {
|
||||||
for (const theme of enabledThemes) if (!theme.endsWith(".user.css")) {
|
|
||||||
const themeData = await VencordNative.themes.getThemeData(theme);
|
const themeData = await VencordNative.themes.getThemeData(theme);
|
||||||
if (!themeData) continue;
|
if (!themeData) continue;
|
||||||
|
|
||||||
|
@ -79,6 +78,7 @@ async function initThemes() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!IS_WEB || "armcord" in window) {
|
||||||
for (const theme of enabledThemes) if (theme.endsWith(".user.css")) {
|
for (const theme of enabledThemes) if (theme.endsWith(".user.css")) {
|
||||||
// UserCSS goes through a compile step first
|
// UserCSS goes through a compile step first
|
||||||
const css = await compileUsercss(theme);
|
const css = await compileUsercss(theme);
|
||||||
|
@ -98,6 +98,7 @@ async function initThemes() {
|
||||||
const blob = new Blob([css], { type: "text/css" });
|
const blob = new Blob([css], { type: "text/css" });
|
||||||
links.push(URL.createObjectURL(blob));
|
links.push(URL.createObjectURL(blob));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
themesStyle.textContent = links.map(link => `@import url("${link.trim()}");`).join("\n");
|
themesStyle.textContent = links.map(link => `@import url("${link.trim()}");`).join("\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue