catcrafts.net/catcrafts-head.js
Jorijn van der Graaf 13a12c2a2c Migrate to crafter-build project.cpp and restructure views
- Replace project.json + run.sh with a C++ project.cpp build descriptor
  (crafter-build), targeting wasm32-wasip1 with the Crafter.Graphics dep
- Add Catcrafts-Views implementation; drop Catcrafts-Component
- Add catcrafts-head.js (sets <title>/<link> tags at runtime)
- Update Blog/Root/main modules, README, and favicon

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-18 23:27:41 +02:00

24 lines
975 B
JavaScript

// Head-element setup for catcrafts.net. The Crafter.Graphics Dom partition
// only exposes element creation under <body>, so anything that has to live in
// <head> (title, stylesheet link, favicon link) gets injected from this
// loader. EnableWasiBrowserRuntime auto-picks up every *.js in cfg.files and
// emits a <script type="module"> tag for it ahead of runtime.js, so this
// runs before the wasm module starts and styles are in place by first paint.
document.title = "Catcrafts.net";
const styles = document.createElement("link");
styles.rel = "stylesheet";
styles.href = "styles.css";
document.head.appendChild(styles);
const favicon = document.createElement("link");
favicon.rel = "icon";
favicon.type = "image/svg+xml";
favicon.href = "favicon.svg";
document.head.appendChild(favicon);
const viewport = document.createElement("meta");
viewport.name = "viewport";
viewport.content = "width=device-width, initial-scale=1.0";
document.head.appendChild(viewport);