From 7a7d36c8c033cfe96dda771ad769313dcda2a197 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sat, 20 Sep 2025 17:47:20 +0100 Subject: [PATCH] Implemented per-page dynamic favicons --- .github/workflows/check.yml | 12 +- package.json | 2 +- src/app.d.ts | 9 + src/lib/components/global/Icon.svelte | 249 +------------------------- src/lib/constants/icon-map.ts | 227 +++++++++++++++++++++++ src/lib/constants/nav.ts | 49 +++++ src/lib/utils/favicon.ts | 71 ++++++++ src/routes/+layout.svelte | 33 +++- 8 files changed, 391 insertions(+), 261 deletions(-) create mode 100644 src/lib/constants/icon-map.ts create mode 100644 src/lib/utils/favicon.ts diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 8ec91bf..1b0ef57 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -33,8 +33,8 @@ jobs: # - run: npm ci # - run: npm run lint - style: - name: 💅 Style + format: + name: 💅 Format runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -43,7 +43,7 @@ jobs: node-version: 22 cache: npm - run: npm ci - - run: npm run style + - run: npm run format types: name: 🧩 Types @@ -111,7 +111,7 @@ jobs: needs: - build # - lint - - style + - format - types - svelte_check - deps_lockfile @@ -122,7 +122,7 @@ jobs: env: BUILD: ${{ needs.build.result }} # LINT: ${{ needs.lint.result }} - STYLE: ${{ needs.style.result }} + FORMAT: ${{ needs.format.result }} TYPES: ${{ needs.types.result }} SVCHK: ${{ needs.svelte_check.result }} DEP_LOCK: ${{ needs.deps_lockfile.result }} @@ -136,7 +136,7 @@ jobs: echo "## PR Checks" line "$BUILD" "Build" line "$LINT" "Lint" - line "$STYLE" "Style" + line "$FORMAT" "Format" line "$TYPES" "Types" line "$SVCHK" "Svelte Check" line "$DEP_LOCK" "Deps - Lockfile" diff --git a/package.json b/package.json index 0fa7790..1507a09 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "prepare": "svelte-kit sync || echo ''", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "lint": "eslint src --ext .ts,.svelte", - "style": "prettier --check src --write", + "format": "prettier --check src --write", "types": "tsc -p tsconfig.json --noEmit", "build-check": "vite build --minify=false --sourcemap=false --logLevel error", "test": "NODE_OPTIONS='--max_old_space_size=8192' vitest", diff --git a/src/app.d.ts b/src/app.d.ts index 520c421..fe5b822 100644 --- a/src/app.d.ts +++ b/src/app.d.ts @@ -1,5 +1,8 @@ // See https://svelte.dev/docs/kit/types#app.d.ts // for information about these interfaces + +/// + declare global { namespace App { // interface Error {} @@ -10,4 +13,10 @@ declare global { } } +// SVG imports +declare module '*.svg' { + const content: string; + export default content; +} + export {}; diff --git a/src/lib/components/global/Icon.svelte b/src/lib/components/global/Icon.svelte index 7fa6606..44ffdb1 100644 --- a/src/lib/components/global/Icon.svelte +++ b/src/lib/components/global/Icon.svelte @@ -1,8 +1,5 @@ - - + + {seoData.title}