feat: add jsFile option to include custom JavaScript

This commit is contained in:
Mathias Schopmans
2024-06-28 16:45:28 +02:00
committed by Stefan Rotsch
parent a443aef0f4
commit 6a5b8637f7
6 changed files with 25 additions and 8 deletions

View File

@@ -22,7 +22,12 @@ export function getAppName() {
}
export function getLogoUrl() {
return assetUrl("/" + config.logoFile);
return assetUrl(config.logoFile);
}
export function getJsUrl(): string {
if (!config.jsFile) return "";
return assetUrl(config.jsFile);
}
export function getChartConfig() {

View File

@@ -7,6 +7,8 @@ export function cn(...inputs: ClassValue[]) {
}
export function assetUrl(path: string) {
if (/^https?:/.test(path)) return path;
if (!config.basePath) return path;
if (!path.startsWith("/")) path = "/" + path;
return `${config.basePath}${path}`;
}