summaryrefslogtreecommitdiff
path: root/examples/with-nanostores/src/utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'examples/with-nanostores/src/utils.ts')
-rw-r--r--examples/with-nanostores/src/utils.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/with-nanostores/src/utils.ts b/examples/with-nanostores/src/utils.ts
new file mode 100644
index 000000000..cbe38f5f3
--- /dev/null
+++ b/examples/with-nanostores/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;