· 3 min read
Skills in YAML, icons as data and an SVG sprite
Planned what comes next: I'm applying for different kinds of jobs and need a CV for each. Phase 5.5 will be a CV builder (a /projects tool: pick a job…
What we did
- Planned what comes next: I'm applying for different kinds of jobs and need a CV for each. Phase 5.5 will be a CV builder (a
/projectstool: pick a job profile, get an ATS-friendly CV), with my personal data kept in my browser, never in the repo. First, the skills had to become easy to edit and know which jobs they matter for. - The skills moved from
skills.tstocontent/skills.yaml. Icons are names (a Simple Icons slug or a Lucide name), and every skill lists its job profiles:web,support,mainframe. skills.server.tsreads and checks the file at build time./aboutgets the skills from a+page.server.tsload.- Brand logos come from
/logos.svg, a sprite that a+server.tsendpoint writes at build time. Pages draw them with<use href>.
What I learned
- A
.server.tsmodule can only be imported by server code; SvelteKit refuses to bundle it for the browser. The icon libraries are imported there, so they can't reach the page by accident. - A server load can only send data. Lucide icons travel as
[tag, attributes]pairs (from the plainlucidepackage) and<svelte:element>draws them; inside an<svg>it creates SVG elements. - A server load's data is embedded in the page for hydration. A sprite drawn in the page put every path in the HTML twice: once drawn, once in that data. A separate file keeps them out of the page.
- A folder named
logos.svginsrc/routes/serves/logos.svg. An endpoint needs its ownexport const prerender = true(the layout's only reaches pages) and an entry inprerender.entries(the crawler follows links, and<use href>isn't one). - TypeScript only narrows after
if (!x) fail()whenfailis a function declaration (or a const with a type annotation) returningnever, not an untyped arrow.
Problems & fixes
- The first build had no
logos.svgand no error: the endpoint wasn't prerendered and nothing linked to it. - My size comparison used
git stash, which leaves new (untracked) files behind, so the "before" build was half new code. Compare against a commit instead.
Links
- SvelteKit:
+server - SvelteKit: server-only modules
- SvelteKit: prerender entries
- Svelte:
<svelte:element> - MDN:
<use> - Lucide: the
lucidepackage
Next
- Edit
content/skills.yaml: my levels, the profiles, what's missing. - A profile filter on
/about, then Phase 5.5, the CV builder.