Spritefoundry is Effect-first TypeScript tooling that turns selected Iconify and custom SVG icons into an app-owned SVG sprite, manifest, and typed icon names.
Status: alpha.
Spritefoundry builds a small, deterministic icon artifact for an application that wants to control exactly which icons it ships. It resolves only configured local sources, validates SVG input, and produces generated files that an application can serve itself.
- App builds often need selected icons rather than a full icon library.
- Runtime icon loading should not require fetching from third-party icon services.
- Icon names and generated artifacts should be deterministic and type-safe across build and runtime integrations.
Spritefoundry is not a general SVG optimizer replacement.
- Configure explicit Iconify and custom SVG sources plus the icons to expose.
- Run the core pipeline through the CLI or Vite plugin.
- Resolve, validate, and normalize each configured icon.
- Emit standalone SVGs, a hashed sprite,
manifest.json, andicons.d.ts. - Load the generated, app-owned sprite at runtime.
JSR is the primary registry:
pnpm add -D jsr:@nicksuomi/spritefoundry jsr:@nicksuomi/spritefoundry-cli @iconify-json/lucide
pnpm add jsr:@nicksuomi/spritefoundry-vueFor Vite:
pnpm add -D jsr:@nicksuomi/spritefoundry-vite viteThe npm packages remain a supported fallback; see usage notes.
Create spritefoundry.config.json:
{
"iconifySources": [{ "name": "lucide", "packageName": "@iconify-json/lucide" }],
"customSources": [{ "name": "brand", "directory": "icons/brand" }],
"icons": [
{ "name": "home", "ref": "lucide:home" },
{ "name": "logo", "ref": "brand:logo" }
],
"output": { "directory": "dist/icons" }
}pnpm node scripts/spritefoundry.mjs build --config spritefoundry.config.jsonThe build writes svg/<icon>.svg, sprite.<hash>.svg, manifest.json, and icons.d.ts.
- CLI — builds an app-owned icon artifact from explicit configuration.
- Vite — runs the same pipeline during
writeBundle. - Runtime — loads the generated sprite once from
manifest.sprite.publicPath. - Vue — provides
SpriteIcon, a preload helper, and manifest-backed name resolution.
See usage notes for integration examples.
One core pipeline owns the artifact contract: source resolution, SVG safety validation, normalization, sprite generation, manifest generation, and types. CLI, Vite, runtime, and Vue packages adapt that contract rather than reimplementing it.
Read ARCHITECTURE.md for package boundaries and extension points.
- Builds read installed Iconify JSON packages and local custom SVG files.
- Runtime helpers fetch only the generated sprite asset owned by the application.
- SVG input with active or external content is rejected rather than repaired.
- Generated sprite filenames are content-hashed.
Read the exact SVG policy before adding custom icons.
- Spritefoundry is alpha; package and integration interfaces may change.
- Custom SVG input must have one
<svg>root and a numericviewBox. - The accepted SVG policy is intentionally narrower than general SVG.
pnpm typecheck
pnpm test
pnpm lintFor dependency-policy changes, also run:
pnpm install --frozen-lockfile
pnpm list --depth 0 -r- Iconify Tools — icon-set tooling; Spritefoundry builds selected, app-owned artifacts.
- vite-plugin-svg-icons — Vite sprite generation; Spritefoundry shares one core contract across CLI, Vite, runtime, and Vue.
Spritefoundry is licensed under Apache-2.0. See NOTICE for attribution.