url.ts (368B)
1 // Base-aware URL helper. On the project page the site is served under 2 // /daemon-sec/, so every internal link must carry that prefix. 3 const BASE = import.meta.env.BASE_URL; // e.g. "/daemon-sec/" 4 5 export function url(path = ''): string { 6 const base = BASE.replace(/\/$/, ''); 7 const p = String(path).replace(/^\//, ''); 8 return p ? `${base}/${p}` : `${base}/`; 9 }