Working instructions for this repository — Benson Fung's personal site.
- Static site built with Eleventy 3 (ESM config in
eleventy.config.js). src/is the source;docs/is the generated output that GitHub Pages serves.- One shared layout:
src/_includes/base.njk. Global site data (name, canonical URL):src/_data/site.json. - Root passthrough files:
robots.txt,.nojekyll(Pages serves the site as plain static files, not Jekyll).
- Install:
npm install - Local preview:
npm run dev(Eleventy dev server with hot reload) - Build:
npm run build— writes todocs/ - Always commit the generated
docs/output alongside source changes. Pages deploys fromdocs/onmaster; a source-only commit leaves the live site stale. - Never hand-edit files in
docs/. Changesrc/and rebuild. - After editing, run
npm run buildand sanity-check the changeddocs/*.htmlbefore committing. - Push to
master; Pages redeploys automatically fromdocs/.
- CSS architecture: cascade layers —
reset,base,theme,components,utilities— insrc/assets/css/style.css. Keep new styles in the correct layer; component styles belong incomponents. - Theming: color comes from CSS custom properties in the
themelayer. Light and dark modes switch via thedata-themeattribute on<html>;src/assets/js/main.jsdefaults to the OSprefers-color-schemeand persists an explicit user choice in localStorage. New UI must work in both themes. - Color: OKLCH palette — deep indigo accents in light mode, teal-blue accents in dark mode.
- Typography: Outfit for headings, Inter for body, each with system-ui fallbacks. No icon fonts; use inline SVG where icons are needed.
- Layout: fluid, responsive, mobile-first. The resume page has a dedicated print stylesheet — keep print output clean.
- Accessibility: semantic HTML, skip-to-content link, real
alttext on images, keyboard-reachable controls. - SEO basics live in the shared layout: canonical URL, Open Graph + Twitter cards, JSON-LD Person schema,
sitemap.xml,robots.txt. Keep metadata current when URLs or page purposes change.
- Pages are Nunjucks templates (
.njk) with front matter (title,description) consumed by the layout. - Assets live under
src/assets/and are passthrough-copied todocs/assets/. - Reference global data from
src/_data/site.jsonrather than hardcoding the site URL in templates. - Commit and push promptly after a change is verified — uncommitted work in this checkout was once lost mid-session (working tree reverted to HEAD with no trace), so don't leave changes uncommitted across long detours.
- Keep braces balanced in
style.css: a single stray}once caused the CSS parser to silently drop the entire@layer utilitiesblock (visible skip link, dead.sr-only). After structural CSS edits, verify the parsed stylesheet in the browser (e.g. checkdocument.styleSheetslayer blocks), not just the source.