Files
Paweł Kunaandgithub-actions[bot] 39634cb4b9 Improve docs SEO, performance and content quality (#2841)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-11 14:45:31 +02:00

18 lines
880 B
TypeScript

// Where shared demo assets (shared/static → <site>/static) are served from.
// The default is relative, so the downloadable preview package keeps working
// when opened from any folder. Apps with nested routes override the base with
// a vite `define` in their astro config — docs sets TABLER_STATIC_BASE to
// '/static' (see docs/astro.config.mjs).
declare const TABLER_STATIC_BASE: string | undefined
const base = typeof TABLER_STATIC_BASE === 'string' ? TABLER_STATIC_BASE : './static'
/** Url of a file from shared/static, e.g. staticPath('photos/cat.jpg'). */
export const staticPath = (file: string): string => `${base}/${file.replace(/^\/+/, '')}`
/**
* Prefix for urls that already contain the static/ segment ("." for the
* relative default, "" when the base is absolute) — see Avatar's `base` prop.
*/
export const assetRoot = base.replace(/\/static$/, '')