Files
EpicNext-Cms/src/lib/default-favicon.ts
T
openhands e5e17d75ae
CI / check (push) Successful in 2m27s
CI / deploy (push) Successful in 1m34s
CI / publish-container (push) Successful in 50s
perf(site): inline small classic icons and favicon as base64
- New src/lib/site-icons.ts: base64 data URIs for the 13 tiny classic
  icons actually referenced in markup (100–2000 bytes), replacing extra
  requests with inline payloads. home.png, dynamic flags and currency
  sets stay on the filesystem.
- Default favicon is now served server-side as a base64 SVG data URI
  (memoized), while a DB-configured custom favicon still takes priority.
- Icons render through <Image unoptimized>, so data URIs pass through
  untouched on all affected pages (home, login, register, settings,
  navigation, auth top bar, client loading).
2026-09-12 17:28:01 +02:00

16 lines
504 B
TypeScript

import { readFileSync } from "node:fs";
import { join } from "node:path";
let cached: string | null = null;
/**
* The bundled default favicon (public/favicon.svg) as a base64 data URI.
* Read once and memoized; only used when no custom favicon is configured.
*/
export function getDefaultFaviconDataUri(): string {
if (cached) return cached;
const raw = readFileSync(join(process.cwd(), "public", "favicon.svg"));
cached = `data:image/svg+xml;base64,${raw.toString("base64")}`;
return cached;
}