mirror of
https://github.com/sern-handler/website
synced 2026-06-24 16:52:22 +00:00
16 lines
529 B
TypeScript
16 lines
529 B
TypeScript
import { stripLeadingSlash, stripTrailingSlash } from './path';
|
||
|
||
const base = stripTrailingSlash(import.meta.env.BASE_URL);
|
||
|
||
/** Get the a root-relative URL path with the site’s `base` prefixed. */
|
||
export function pathWithBase(path: string) {
|
||
path = stripLeadingSlash(path);
|
||
return path ? base + '/' + path : base + '/';
|
||
}
|
||
|
||
/** Get the a root-relative file URL path with the site’s `base` prefixed. */
|
||
export function fileWithBase(path: string) {
|
||
path = stripLeadingSlash(path);
|
||
return path ? base + '/' + path : base;
|
||
}
|