Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/lukebennett88/luke-ui. ui.lukebennett.dev
Something went wrong. Try again.
12345678910111213const LEADING_SLASH_PATTERN = /^\//;
/** * Prefixes a root-relative public path with the app's configured base path * (`import.meta.env.BASE_URL`), so links keep working when the site deploys * under a sub-path such as `/luke-ui/`. */export function withBasePath(publicPath: string, basePath: string): string { if (basePath === '/' || basePath === '') return publicPath; const normalizedBase = basePath.endsWith('/') ? basePath : `${basePath}/`; return `${normalizedBase}${publicPath.replace(LEADING_SLASH_PATTERN, '')}`;}