Documentation
¶
Overview ¶
Command gen-octicons reads the @primer/octicons build/data.json shipped by the npm package and writes a trimmed, embed-friendly assets/octicons/data.json that internal/render.ReplaceOcticons consumes at runtime.
Approach:
The upstream build/data.json is a map keyed by icon name. Each entry has a "heights" sub-object whose keys are the available pixel sizes ("16", "24"). Inside each size we have a "width" and a "path" (an HTML fragment such as `<path d="..."/>`).
We materialize the equivalent `<svg xmlns=... width=H height=H viewBox="0 0 H H">{path}</svg>` string for every (name, size) pair and store it in our output JSON under `icons[name][size]`. The `class="octicon"` attribute is NOT baked in; the runtime injects it during the replacement to keep this asset reusable.
Output schema (see specs/003-chromedp-rendering-pipeline/data-model.md E-006):
{
"_meta": {"source": "primer/octicons@<version>", "generated_at": "<rfc3339>"},
"icons": { "<name>": { "<size>": "<svg ...>...</svg>" } }
}
Exit codes:
0 data.json written 1 invocation / I/O / decode error