gen-octicons

command
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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:

{
  "_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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL