Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/favicon-192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/favicon-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/favicon-96x96.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/favicon.ico
Binary file not shown.
4 changes: 3 additions & 1 deletion public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions scripts/copy-docs-images.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,31 @@ const docsImagesSrc = path.resolve(__dirname, "..", "content", "docs", "images")
const publicDir = path.resolve(__dirname, "..", "public");
const publicResourcesDir = path.resolve(publicDir, "resources");

// Favicons + PWA manifest are committed at public/ root as the source of truth,
// but the docs Cloudflare Worker only serves assets under /docs/* — top-level
// public/ files land at the site root, which the worker never sees. Mirror them
// into public/docs/ (git-ignored, build-generated) so they're emitted at
// /docs/favicon.* and served by the docs worker itself. The hrefs in
// src/routes/__root.tsx reference these via buildDocsPath ("/docs/..").
const FAVICON_FILES = [
"favicon.svg",
"favicon.ico",
"favicon-96x96.png",
"favicon-192.png",
"favicon-512.png",
"apple-touch-icon.png",
"site.webmanifest",
];
const publicDocsDir = path.resolve(publicDir, "docs");
fs.mkdirSync(publicDocsDir, { recursive: true });
for (const name of FAVICON_FILES) {
const srcPath = path.join(publicDir, name);
if (fs.existsSync(srcPath)) {
fs.copyFileSync(srcPath, path.join(publicDocsDir, name));
}
}
console.log("[copy-docs-images] Copied favicons + manifest -> public/docs/");

function syncDir(src, dest) {
fs.mkdirSync(dest, { recursive: true });

Expand Down
7 changes: 5 additions & 2 deletions src/routes/__root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,11 @@ export const Route = createRootRoute({
],
links: [
{ rel: "stylesheet", href: appCss },
// Favicons + PWA manifest, copied from the main superwall.com site. Served
// from public/ under the /docs base, so hrefs are resolved via buildDocsPath.
// Favicons + PWA manifest. The docs Cloudflare Worker only serves assets
// under /docs/*, so these are referenced under the /docs base (buildDocsPath).
// The committed source lives at public/ root and is mirrored into public/docs/
// at build time by scripts/copy-docs-images.cjs, so /docs/favicon.* resolves
// from this worker (its own $W mark, not superwall.com's root favicon).
{ rel: "icon", type: "image/svg+xml", href: buildDocsPath("favicon.svg") },
{ rel: "icon", type: "image/png", sizes: "96x96", href: buildDocsPath("favicon-96x96.png") },
{ rel: "shortcut icon", href: buildDocsPath("favicon.ico") },
Expand Down
Loading