Example: Adding an Icon to glyphicons-v1
A complete, nothing-skipped walkthrough: adding one new icon, wrench-adjustable, to the existing icons/glyphicons-v1/halflings/ folder. Every command below is meant to be run for real, in order.
This is the “existing sub-folder” case — the fast path. If the sub-folder itself doesn’t exist yet, that’s a different (longer) process — see Adding a whole new icon set instead.
1. Add the icon asset
glyphicons-v1 ships as an icon font — each .svg is one glyph exported from that font, named after its ligature code (icon_uni<CODE>.svg), not a descriptive name. Add the exported file, numbered one past the last one in the folder:
icons/glyphicons-v1/halflings/icon_uniE261.svg2. Add the entry to mapping.json
glyphicons-v1 is the one library whose mapping.json bakes the
sub-library name into the key twice: once as the leading
space-separated word, once again as a prefix on the classname itself.
Every other library just uses the plain classname (see Normalize
mapping.json).
{
// ...existing entries
"halflings halflings-wrench-adjustable": "icon_uniE261.svg"
}3. mapping-with-filepath.json — there isn’t one
Unlike glyphicons-v2 and phpc, glyphicons-v1 has no combined mapping file and no generate-mapping.py step. IconDropdown.tsx imports each sub-folder’s mapping.json directly, by its literal path (see the import question):
import iconsGlyphiconsV1Halflings from "../../icons/glyphicons-v1/halflings/mapping.json";Since that import already points at the file you just edited in step 2, the data side is done — skip straight to keywords.
4. Regenerate keywords.json
icons/glyphicons-v1/halflings/mapping.json is already one of the hand-written tuples in script/generate-keywords.py’s sets list, with "halflings" as the prefix to strip — no edit needed there for an existing sub-folder. Just re-run the generator:
python3 script/generate-keywords.pyTrace of what it just did for halflings halflings-wrench-adjustable (see Keywords & Translations for the full algorithm):
- Take the last space-separated part of the key:
"halflings-wrench-adjustable" - Strip the
halflings-prefix:"wrench-adjustable" - Split:
["wrench", "adjustable"] - Translate:
wrench→"clé à molette"(already intranslations-en-fr.json),adjustable→ not found, falls back to"adjustable"unchanged - FR phrase
"clé à molette adjustable"differs from EN"wrench adjustable"→ added as a keyword - More than one word → no-separator join
"wrenchadjustable"also added
"halflings halflings-wrench-adjustable": ["clé à molette adjustable", "wrenchadjustable"]5. (Optional) Add the missing translation
{
// ...existing entries
"adjustable": "réglable"
}Re-run the same command as step 4:
"halflings halflings-wrench-adjustable": ["clé à molette réglable", "wrenchadjustable"]6. IconDropdown.tsx — no change needed
This is an existing sub-folder: iconsGlyphiconsV1Halflings and its keywords are already imported and already wired into v1Sets / v1KeywordSets. Nothing to touch here for this case — that’s only required when the sub-folder itself is brand new, or for a genuinely new top-level library (see Adding a whole new icon set, part B).
7. Verify
Run the app, open IconDropdown, and confirm the icon is findable by:
wrench-adjustable(English classname)clé à molette réglable(French translation)wrenchadjustable(no-separator English)
Files touched
| File | What happened |
|---|---|
icons/glyphicons-v1/halflings/icon_uniE261.svg | New asset |
icons/glyphicons-v1/halflings/mapping.json | Hand-edited |
icons/glyphicons-v1/halflings/keywords.json | Regenerated (generate-keywords.py) |
script/translations-en-fr.json | Hand-edited, optional |
Notice what’s missing compared to the glyphicons-v2 example: no
generate-mapping.py, no combined mapping file, no master mapping. That
asymmetry is the whole point of the import
question
— glyphicons-v1 is the library where the icon data pipeline is fully
manual, not just the keywords.
Related pages
- Adding New Icons — the general checklist this example follows
- Keywords & Translations — how
generate-keywords.pycombines its three inputs - Search in IconDropdown — how the generated
keywords.jsonis actually matched against