Files
horizon-airdef/website/scripts/assets.mjs
T
Ludovic Marie c49a91a22c Restyle the website in the new design language
The page now reads the design tokens generated from crates/horizon-theme (src/tokens.css, put
before style.css by build.mjs), and follows the system's light or dark appearance, with a
toggle that remembers the choice. The full-screen sunset hero is replaced by type: a headline,
one paragraph, the download, and an index list of what the page holds. Every section is a mono
label, a display heading and its content as numbered rows with one-pixel rules: the facts, the
fourteen subsystems, the launcher's features, the community links. Rows fade a soft plate in
under the pointer; content arrives with a short fade, rise and unblur. The footer ends on the
giant faint wordmark. The 404 page and the social preview (og.html) follow.

Instrument Serif, the hero images, the parallax, the statement fill and the magnetic buttons
are gone; the icons come from Horizon's new mark (xtask icons). Touch targets are 44 px high.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 00:08:40 +02:00

57 lines
2.3 KiB
JavaScript

// Copies the launcher's fonts and the repo's screenshots into public/,
// converted for the web (woff2, webp in two widths). Run it after any of them change:
// `npm run assets`. Its output is committed, because Railway builds only website/.
import { mkdir, readFile, writeFile, copyFile } from "node:fs/promises";
import { join, dirname } from "node:path";
import { fileURLToPath } from "node:url";
import sharp from "sharp";
import wawoff2 from "wawoff2";
const site = join(dirname(fileURLToPath(import.meta.url)), "..");
const repo = join(site, "..");
const pub = join(site, "public");
const fonts = [
"Geist-Regular.ttf",
"Geist-Medium.ttf",
"Geist-SemiBold.ttf",
"GeistMono-Regular.ttf",
];
// [source, name]; every image becomes media/<name>.webp and media/<name>-800.webp.
export const images = [
["docs/media/sunset.jpg", "sunset"],
["docs/media/village.jpg", "village"],
["docs/media/survival.jpg", "survival"],
["docs/media/nether.jpg", "nether"],
["docs/media/night.jpg", "night"],
["docs/media/underwater.jpg", "underwater"],
["docs/media/menu-title.png", "menu-title"],
["docs/media/menu-worlds.png", "menu-worlds"],
["docs/media/menu-options.png", "menu-options"],
["docs/media/menu-pause.png", "menu-pause"],
["docs/media/settings-simple.png", "settings"],
];
await mkdir(join(pub, "fonts"), { recursive: true });
await mkdir(join(pub, "media"), { recursive: true });
for (const font of fonts) {
const ttf = await readFile(join(repo, "crates/horizon-theme/fonts", font));
await writeFile(join(pub, "fonts", font.replace(".ttf", ".woff2")), await wawoff2.compress(ttf));
}
for (const licence of ["OFL-Geist.txt"]) {
await copyFile(join(repo, "crates/horizon-theme/fonts", licence), join(pub, "fonts", licence));
}
for (const [source, name] of images) {
const input = join(repo, source);
await sharp(input).resize({ width: 1600, withoutEnlargement: true }).webp({ quality: 82 }).toFile(join(pub, "media", `${name}.webp`));
await sharp(input).resize({ width: 800 }).webp({ quality: 78 }).toFile(join(pub, "media", `${name}-800.webp`));
}
// The icons (favicon.svg, favicon-32.png, apple-touch-icon.png) come from Horizon's mark:
// `cargo run -p xtask -- icons` writes them with the rest of the brand (docs/media/brand).
console.log("assets written to public/");