diff --git a/src/lib/LogoText.svelte b/src/lib/components/LogoText.svelte similarity index 100% rename from src/lib/LogoText.svelte rename to src/lib/components/LogoText.svelte diff --git a/src/lib/Slideshow.svelte b/src/lib/components/Slideshow.svelte similarity index 100% rename from src/lib/Slideshow.svelte rename to src/lib/components/Slideshow.svelte diff --git a/src/lib/constants.ts b/src/lib/constants.ts index fa79390..2c9bf97 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -6,4 +6,11 @@ export const SITE_DESCRIPTION = export const BASE_URL = env["PUBLIC_BASE_URL"] || "http://localhost:5173"; export const BRAND_COLOR = "#c41313"; -export default { SITE_NAME, SITE_DESCRIPTION, BASE_URL, BRAND_COLOR }; +const constants = { SITE_NAME, SITE_DESCRIPTION, BASE_URL, BRAND_COLOR }; + +export function insertInto(text: string): string { + for (const [key, value] of Object.entries(constants)) { + text = text.replaceAll("%" + key + "%", value); + } + return text; +} diff --git a/src/lib/insert_constants.ts b/src/lib/insert_constants.ts deleted file mode 100644 index ed748e3..0000000 --- a/src/lib/insert_constants.ts +++ /dev/null @@ -1,8 +0,0 @@ -import constants from "$lib/constants"; - -export default function (text: string): string { - for (const [key, value] of Object.entries(constants)) { - text = text.replaceAll("%" + key + "%", value); - } - return text; -} diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index e1b1ae5..8ab434c 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,6 +1,6 @@ diff --git a/src/routes/robots.txt/+server.ts b/src/routes/robots.txt/+server.ts index 2d14d73..f123521 100644 --- a/src/routes/robots.txt/+server.ts +++ b/src/routes/robots.txt/+server.ts @@ -1,7 +1,7 @@ import type { RequestHandler } from "@sveltejs/kit"; import robots from "./robots.txt?raw"; -import insert_constants from "$lib/insert_constants"; +import { insertInto } from "$lib/constants"; export const GET: RequestHandler = async () => { - return new Response(insert_constants(robots)); + return new Response(insertInto(robots)); }; diff --git a/src/routes/site.webmanifest/+server.ts b/src/routes/site.webmanifest/+server.ts index de5b842..4d8f495 100644 --- a/src/routes/site.webmanifest/+server.ts +++ b/src/routes/site.webmanifest/+server.ts @@ -1,7 +1,7 @@ import type { RequestHandler } from "@sveltejs/kit"; import manifest from "./site.webmanifest?raw"; -import insert_constants from "$lib/insert_constants"; +import { insertInto } from "$lib/constants"; export const GET: RequestHandler = async () => { - return new Response(insert_constants(manifest)); + return new Response(insertInto(manifest)); };