andy-stack_vaultkeeper-ai/Services/AssetsService.ts
Andrew Beal e5a9e4a24b refactor: bundle assets at build time instead of loading from disk
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.
2026-06-01 00:04:39 +01:00

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;
}
}