From ffd7cdd0bdbc64e2f267e805c47755512933234d Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Wed, 14 May 2025 23:20:42 +0200 Subject: [PATCH] fix(init): fetch favicon from network like before (#2948) Reverts back to fetching the favicon from the network. Copying assets from JSR turns out to be difficult. Fixes https://github.com/denoland/fresh/issues/2941 --- init/src/init.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/init/src/init.ts b/init/src/init.ts index 48190a13..793230fd 100644 --- a/init/src/init.ts +++ b/init/src/init.ts @@ -392,12 +392,14 @@ ${GRADIENT_CSS}`; `; await writeFile("static/logo.svg", STATIC_LOGO); - await writeFile( - "static/favicon.ico", - await Deno.readFile( - new URL(import.meta.resolve("./assets/favicon.ico")), - ), - ); + + try { + const res = await fetch("https://fresh.deno.dev/favicon.ico"); + const buf = await res.arrayBuffer(); + await writeFile("static/favicon.ico", new Uint8Array(buf)); + } catch { + // Skip this and be silent if there is a network issue. + } const MAIN_TS = `import { App, fsRoutes, staticFiles } from "fresh"; import { define, type State } from "./utils.ts";