Dev: Hot reload core css
This commit is contained in:
parent
0e5b8b07c9
commit
fd766bc98f
1 changed files with 6 additions and 1 deletions
|
@ -19,7 +19,7 @@
|
|||
import { debounce } from "@utils/debounce";
|
||||
import IpcEvents from "@utils/IpcEvents";
|
||||
import { contextBridge, ipcRenderer, webFrame } from "electron";
|
||||
import { readFileSync } from "fs";
|
||||
import { readFileSync, watch } from "fs";
|
||||
import { join } from "path";
|
||||
|
||||
import VencordNative from "./VencordNative";
|
||||
|
@ -48,6 +48,11 @@ if (location.protocol !== "data:") {
|
|||
try {
|
||||
const css = readFileSync(rendererCss, "utf-8");
|
||||
insertCss(css);
|
||||
if (IS_DEV) {
|
||||
watch(rendererCss, debounce(() => {
|
||||
document.getElementById("vencord-css-core")!.textContent = readFileSync(rendererCss, "utf-8");
|
||||
}, 30));
|
||||
}
|
||||
} catch (err) {
|
||||
if ((err as NodeJS.ErrnoException)?.code !== "ENOENT")
|
||||
throw err;
|
||||
|
|
Loading…
Reference in a new issue