From 0e93603c9ac9e65383ef9f6ff61f98a37f1d78cb Mon Sep 17 00:00:00 2001 From: "@quartzite-roller.test.pds.did.bot" Date: Mon, 26 Oct 2026 15:25:38 -0400 Subject: [PATCH] feat(site): bundle the Tangled and GitHub logos as link icons The build writes them to icons/, and the mockup inlines them so it still opens without files. Co-Authored-By: Claude Opus 5.5 Change-Id: Ia37ccb8a5beb1fd5ea9ecc1d4eb0aa24f2328c26 --- scripts/build_mockup.py | 9 +++++++++ src/site.rs | 9 +++++++++ web/icons/github.svg | 1 + web/icons/tangled.svg | 1 + 4 files changed, 20 insertions(+) create mode 100644 web/icons/github.svg create mode 100644 web/icons/tangled.svg diff --git a/scripts/build_mockup.py b/scripts/build_mockup.py index b4abbdd..2c273fe 100644 --- a/scripts/build_mockup.py +++ b/scripts/build_mockup.py @@ -5,6 +5,7 @@ and app.js inlined, so it opens without a server. python3 scripts/build_mockup.py dist/data/site.json """ +import base64 import json import re import sys @@ -26,6 +27,14 @@ assert link in html and script in html, "index.html changed shape" # The worker fills index.html's meta placeholders; the mockup only needs them # gone. html = re.sub(r"\{\{\w+\}\}", "", html) +# The link icons the stylesheet loads, inlined so the mockup needs no files. +css = re.sub( + r'url\("icons/(\w+)\.svg"\)', + lambda m: 'url("data:image/svg+xml;base64,' + + base64.b64encode((web / "icons" / f"{m.group(1)}.svg").read_bytes()).decode() + + '")', + css, +) html = html.replace(link, f"") html = html.replace(script, f"\n ") (root / "docs" / "mockup.html").write_text(html, encoding="utf-8") diff --git a/src/site.rs b/src/site.rs index ff8f92e..ac99b3d 100644 --- a/src/site.rs +++ b/src/site.rs @@ -15,10 +15,16 @@ const APP: &str = include_str!("../web/app.js"); const STYLE: &str = include_str!("../web/style.css"); const FONT_REGULAR: &[u8] = include_bytes!("../web/fonts/courier-prime-400.woff2"); const FONT_BOLD: &[u8] = include_bytes!("../web/fonts/courier-prime-700.woff2"); +/// The forge logos that link a project to its repository, as `icons/{name}.svg`. +const ICONS: [(&str, &str); 2] = [ + ("tangled", include_str!("../web/icons/tangled.svg")), + ("github", include_str!("../web/icons/github.svg")), +]; pub fn write(dir: &Path, data: &SiteData, layout: Option<&str>) -> Result<()> { fs::create_dir_all(dir.join("data")).with_context(|| format!("creating {}", dir.display()))?; fs::create_dir_all(dir.join("fonts")).with_context(|| format!("creating {}", dir.display()))?; + fs::create_dir_all(dir.join("icons")).with_context(|| format!("creating {}", dir.display()))?; let card = og::Card::new(&data.daily, data.summary.windows.all_30); let layout = og::Layout::select(layout)?; @@ -51,6 +57,9 @@ pub fn write(dir: &Path, data: &SiteData, layout: Option<&str>) -> Result<()> { fs::write(dir.join("style.css"), STYLE)?; fs::write(dir.join("fonts/courier-prime-400.woff2"), FONT_REGULAR)?; fs::write(dir.join("fonts/courier-prime-700.woff2"), FONT_BOLD)?; + for (name, svg) in ICONS { + fs::write(dir.join(format!("icons/{name}.svg")), svg)?; + } let site = serde_json::to_vec(data)?; fs::write(dir.join("data/site.json"), site)?; diff --git a/web/icons/github.svg b/web/icons/github.svg new file mode 100644 index 0000000..a06e1da --- /dev/null +++ b/web/icons/github.svg @@ -0,0 +1 @@ + diff --git a/web/icons/tangled.svg b/web/icons/tangled.svg new file mode 100644 index 0000000..b6646db --- /dev/null +++ b/web/icons/tangled.svg @@ -0,0 +1 @@ + -- knotmirror 0.0.1