Improve styleloader, fix clearing emotes. (#506)
* improve styleloader for local development. * fix clearing emotes
This commit is contained in:
parent
db84e73f50
commit
3ab655594b
|
@ -62,7 +62,7 @@ export default new class EmoteModule extends Builtin {
|
||||||
}
|
}
|
||||||
|
|
||||||
async enabled() {
|
async enabled() {
|
||||||
Settings.registerCollection("emotes", "Emotes", EmoteConfig, {title: Strings.Emotes.clearEmotes, onClick: this.resetEmotes});
|
Settings.registerCollection("emotes", "Emotes", EmoteConfig, {title: Strings.Emotes.clearEmotes, onClick: this.resetEmotes.bind(this)});
|
||||||
await this.getBlocklist();
|
await this.getBlocklist();
|
||||||
await this.loadEmoteData();
|
await this.loadEmoteData();
|
||||||
|
|
||||||
|
|
|
@ -124,12 +124,17 @@ export default new class Core {
|
||||||
|
|
||||||
async loadDependencies() {
|
async loadDependencies() {
|
||||||
for (const data of this.dependencies) {
|
for (const data of this.dependencies) {
|
||||||
if (Config.local && Config.localPath && data.localPath) {
|
if (Config.local && Config.localPath && data.localPath && data.type == "style") {
|
||||||
if (fs.existsSync(path.resolve(Config.localPath, data.localPath))) {
|
const stylepath = path.resolve(Config.localPath, data.localPath);
|
||||||
const css = fs.readFileSync(path.resolve(Config.localPath, data.localPath)).toString();
|
if (fs.existsSync(stylepath)) {
|
||||||
|
Logger.log("Startup", `Loading local stylesheet from (${stylepath})`);
|
||||||
|
const css = fs.readFileSync(stylepath).toString();
|
||||||
DOMManager.injectStyle(data.name, css);
|
DOMManager.injectStyle(data.name, css);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
Logger.warn("Startup", "Local stylesheet was not found, loading remote...");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const url = Utilities.formatString(data.url, {hash: Config.hash});
|
const url = Utilities.formatString(data.url, {hash: Config.hash});
|
||||||
Logger.log(`Startup`, `Loading Resource (${url})`);
|
Logger.log(`Startup`, `Loading Resource (${url})`);
|
||||||
|
|
Loading…
Reference in New Issue