Something went wrong. Try again.
slides from July atproto.la meetup talk on an atmospheric cms
Something went wrong. Try again.
2.4 kB · 67 lines
JavaScript
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768// pnpm build [talk...] — builds each talk to dist/<talk>/ plus an index page at dist/import { cpSync, mkdirSync, rmSync, writeFileSync } from "node:fs";import { join } from "node:path";import { distDir, listTalks, pickTalk, root, slidev } from "./lib.mjs";
const only = process.argv.slice(2);const talks = listTalks();const building = only.length ? only.map(pickTalk) : talks;
if (!only.length) rmSync(distDir, { recursive: true, force: true });mkdirSync(distDir, { recursive: true });
// public/ holds site-root files (the favicon, shared with tyler.fun) that every// talk points at by absolute path.cpSync(join(root, "public"), distDir, { recursive: true });
for (const talk of building) { console.log(`\n▸ ${talk.slug}`); slidev(["build", talk.entry, "--base", `/${talk.slug}/`, "--out", join(distDir, talk.slug)]);}
const escape = (s) => s.replace(/[&<>"]/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[c]);
writeFileSync( join(distDir, "index.html"), `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Slides — tyler.fun</title><link rel="icon" type="image/x-icon" href="/favicon.ico"><style> :root { --bg: #0e0f10; --ink: #f2efe6; --dim: #bdb9ad; --line: #34332e; } body { margin: 0; background: var(--bg); color: var(--ink); font: 300 1.1rem/1.5 Poppins, system-ui, sans-serif; } main { max-width: 40rem; margin: 0 auto; padding: 4rem 1rem; } h1 { font-family: "Chalkboard SE", Chalkboard, Kalam, cursive; font-size: 2.7rem; margin: 0 0 2rem; } ul { list-style: none; margin: 0; padding: 0; } li { border-top: 1px solid var(--line); display: flex; align-items: baseline; gap: 1rem; padding: 1rem 0; } a { color: inherit; text-decoration: none; } a:hover { text-decoration: underline; } .talk { flex: 1; } .video, time { color: var(--dim); white-space: nowrap; } .video::before { content: "▶ "; font-size: 0.8em; }</style></head><body><main><h1>Slides</h1><ul>${talks .map( (t) => `<li><a class="talk" href="/${t.slug}/">${escape(t.title)}</a>` + (t.video ? `<a class="video" href="${escape(t.video)}">video</a>` : "") + (t.date ? `<time>${escape(t.date)}</time>` : "") + `</li>`, ) .join("\n")}</ul></main></body></html>`,);
console.log(`\nBuilt ${building.length} talk(s) → dist/`);