fix: generate favicon.ico in init script (#278)
Browsers try to get `/favicon.ico` by default. This request enters `[name].tsx` and returns greet unexpectedly. To fix this, the favicon is now fetched from `https://fresh.deno.dev` and saved into the `static` folder in the init script.
This commit is contained in:
@@ -233,6 +233,17 @@ await Deno.writeTextFile(
|
||||
STATIC_LOGO,
|
||||
);
|
||||
|
||||
try {
|
||||
const faviconArrayBuffer = await fetch("https://fresh.deno.dev/favicon.ico")
|
||||
.then((d) => d.arrayBuffer());
|
||||
await Deno.writeFile(
|
||||
join(directory, "static", "favicon.ico"),
|
||||
new Uint8Array(faviconArrayBuffer),
|
||||
);
|
||||
} catch {
|
||||
// Skip this and be silent if there is a nework issue.
|
||||
}
|
||||
|
||||
let MAIN_TS = `/// <reference no-default-lib="true" />
|
||||
/// <reference lib="dom" />
|
||||
/// <reference lib="dom.asynciterable" />
|
||||
|
||||
Reference in New Issue
Block a user