From af4ac943a92daca2b7291a81c4a96c312f12c9a0 Mon Sep 17 00:00:00 2001 From: KoalaDev <6156589+Shik3i@users.noreply.github.com> Date: Sun, 12 Jul 2026 04:34:53 +0200 Subject: [PATCH] Landing performance: flag font subset, responsive mascots, AVIF cache, HTML minify - Flag font: ship a committed fontTools subset (43 KB, -45%) of TwemojiCountryFlags.woff2 with only the 15 flags the site uses, under a content-hashed name with a preload on every flag-bearing page. The build validates the subset against a manifest and fails when a new flag appears without regenerating (npm run subset-flags). JS subsetters (subset-font/harfbuzzjs) were rejected: their wasm builds silently drop the COLR/CPAL color tables, rendering all flags invisible. - Responsive mascots: legal/join/404 pages served 434-500px sources for 175-180px slots; the build now emits 180w/360w variants (AVIF 1x: ~7 KB vs ~22 KB) and the pages use srcset. Small logo spots (14-42px) now use the existing 64/128px variants instead of the 256px file. - injectAvifPictures copies the img sizes attribute onto the AVIF ; without it Chrome mis-selects w-descriptor candidates and can drop the image entirely. - AVIF conversion is cached by content hash (.avif-cache.json); the old mtime check never hit because copyDirSync refreshes mtimes, so every verify re-encoded all 26 files. - HTML output is minified (comments + indentation,
 preserved,
  newlines kept for inline-script safety): index.html 121 KB -> 93 KB.
- unicode-range trimmed to U+1F1E6-1F1FF; tag-sequence flags fall through
  to the system emoji font.

Co-Authored-By: Claude Fable 5 
---
 .gitignore                                    |   1 +
 package-lock.json                             |   4 +-
 package.json                                  |   1 +
 website/404.html                              |   4 +-
 .../assets/TwemojiCountryFlags.subset.json    |  22 +++
 .../assets/TwemojiCountryFlags.subset.woff2   | Bin 0 -> 43336 bytes
 website/build.cjs                             | 151 ++++++++++++++++--
 website/datenschutz-de.html                   |   4 +-
 website/flag-font-utils.cjs                   |  48 ++++++
 website/impressum-de.html                     |   4 +-
 website/imprint.html                          |   4 +-
 website/join.html                             |   6 +-
 website/privacy.html                          |   4 +-
 website/styles/foundation.css                 |   5 +-
 website/template.html                         |  12 +-
 website/tools/subset-flag-font.mjs            |  73 +++++++++
 website/tools/subset_flag_font.py             |  90 +++++++++++
 17 files changed, 397 insertions(+), 36 deletions(-)
 create mode 100644 website/assets/TwemojiCountryFlags.subset.json
 create mode 100644 website/assets/TwemojiCountryFlags.subset.woff2
 create mode 100644 website/flag-font-utils.cjs
 create mode 100644 website/tools/subset-flag-font.mjs
 create mode 100644 website/tools/subset_flag_font.py

diff --git a/.gitignore b/.gitignore
index 869a74a..e193446 100644
--- a/.gitignore
+++ b/.gitignore
@@ -43,6 +43,7 @@ extension/shared/
 
 # Auto-generated website build output
 website/www/
+website/.avif-cache.json
 
 # Temporary scratch files
 scratch/
diff --git a/package-lock.json b/package-lock.json
index dd0655a..d314241 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
 {
   "name": "koalasync",
-  "version": "2.5.3",
+  "version": "2.5.4",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "koalasync",
-      "version": "2.5.3",
+      "version": "2.5.4",
       "devDependencies": {
         "@playwright/test": "^1.61.1",
         "@vitest/coverage-v8": "^4.1.9",
diff --git a/package.json b/package.json
index 6ff8a85..b72eacc 100644
--- a/package.json
+++ b/package.json
@@ -9,6 +9,7 @@
     "indexnow": "node website/submit-indexnow.cjs",
     "lint": "eslint .",
     "lint:fix": "eslint . --fix",
+    "subset-flags": "node website/tools/subset-flag-font.mjs",
     "test": "npm run verify",
     "test:unit": "vitest run",
     "verify": "node scripts/verify-release.mjs"
diff --git a/website/404.html b/website/404.html
index 3855d1a..c1dcd35 100644
--- a/website/404.html
+++ b/website/404.html
@@ -92,7 +92,7 @@