diff --git a/build.sh b/build.sh index e7d8b1f..b98d245 100755 --- a/build.sh +++ b/build.sh @@ -21,3 +21,9 @@ fi npx pwa-assets-generator npx vite build + +# Replace index.html variables with stuff from our env +perl -i -pe"s|{DESCRIPTION}|$VITE_PLATFORM_DESCRIPTION|g" build/index.html +perl -i -pe"s|{ACCENT}|$VITE_PLATFORM_ACCENT|g" build/index.html +perl -i -pe"s|{NAME}|$VITE_PLATFORM_NAME|g" build/index.html +perl -i -pe"s|{URL}|$VITE_PLATFORM_URL|g" build/index.html diff --git a/src/app.html b/src/app.html index adf8bd8..399c95e 100644 --- a/src/app.html +++ b/src/app.html @@ -3,6 +3,26 @@ + + + + + + + + + + + + + + + + + + + + %sveltekit.head% diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 24bd0f4..9c2b0ca 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,6 +1,5 @@ - - - - - - {#await ready}
{:then} diff --git a/vite.config.ts b/vite.config.ts index 053c68d..dce464d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -9,11 +9,6 @@ import svg from "@poppanator/sveltekit-svg" dotenv.config({path: ".env.local"}) dotenv.config({path: ".env"}) -const FAVICONS_DIR = "static/favicons" -const name = process.env.VITE_PLATFORM_NAME -const accent = process.env.VITE_PLATFORM_ACCENT -const description = process.env.VITE_PLATFORM_DESCRIPTION - export default defineConfig({ server: { port: 1847, @@ -30,10 +25,10 @@ export default defineConfig({ maximumFileSizeToCacheInBytes: 5 * 1024 ** 2, // 5 MB or set to something else }, manifest: { - name: name, - short_name: name, - theme_color: accent, - description: description, + name: process.env.VITE_PLATFORM_NAME, + short_name: process.env.VITE_PLATFORM_NAME, + theme_color: process.env.VITE_PLATFORM_ACCENT, + description: process.env.VITE_PLATFORM_DESCRIPTION, permissions: ["clipboardRead", "clipboardWrite", "unlimitedStorage"], icons: [ {src: "pwa-64x64.png", sizes: "64x64", type: "image/png"},