mirror of
https://github.com/andy-stack/vaultkeeper-ai.git
synced 2026-07-22 06:42:03 +00:00
Remove runtime asset loading from AssetsService by importing assets directly and configuring esbuild loaders for SVG (text) and PNG (dataurl). This ensures assets work in release builds where only main.js is shipped without the Assets folder.
23 lines
No EOL
771 B
TypeScript
23 lines
No EOL
771 B
TypeScript
import { addIcon } from "obsidian";
|
|
import iconSvg from "../Assets/vaultkeeper-mono.svg";
|
|
import bannerSource from "../Assets/vaultkeeper-social-1280x330.png";
|
|
|
|
export class AssetsService {
|
|
|
|
public pluginIcon: string;
|
|
public bannerSource: string;
|
|
|
|
// Assets are bundled into main.js at build time (see esbuild loader config).
|
|
// They must NOT be read from disk at runtime: released/mobile installs ship
|
|
// only main.js, manifest.json and styles.css, so the Assets/ folder is absent.
|
|
public constructor() {
|
|
this.pluginIcon = this.addIcon(iconSvg, "vaultkeeper-ai-icon");
|
|
this.bannerSource = bannerSource;
|
|
}
|
|
|
|
private addIcon(icon: string, name: string): string {
|
|
addIcon(name, icon);
|
|
return name;
|
|
}
|
|
|
|
} |