aboutsummaryrefslogtreecommitdiff
path: root/src/utils.ts
diff options
context:
space:
mode:
authorGravatar github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> 2025-06-05 12:45:04 +0000
committerGravatar github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> 2025-06-05 12:45:04 +0000
commitb4feb81355f9832c5698f81f8fdf33121e0189a5 (patch)
tree5b326153146a75a1e99ce8df0f04832b8cc79868 /src/utils.ts
downloadastro-examples/with-nanostores.tar.gz
astro-examples/with-nanostores.tar.zst
astro-examples/with-nanostores.zip
Sync from 0947a69192ad6820970902c7c951fb0cf31fcf4bexamples/with-nanostores
Diffstat (limited to 'src/utils.ts')
-rw-r--r--src/utils.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/utils.ts b/src/utils.ts
new file mode 100644
index 000000000..cbe38f5f3
--- /dev/null
+++ b/src/utils.ts
@@ -0,0 +1,4 @@
+const base = import.meta.env.BASE_URL.replace(/\/$/, '');
+
+/** Prefix a URL path with the site’s base path if set. */
+export const withBase = (path: string) => base + path;