The cache group manages the local disk cache for Iconify API responses. Pre-warming the cache avoids network calls during builds; clearing it forces fresh data on the next fetch.
When to use these commands
CI/CD pipelines: Run cache warm in a setup step so the build has all required icons locally, even if the Iconify API is unreachable during the build itself.
Offline development: Warm the cache before going offline. The cached SVG files remain available to IconifyProvider without network access.
Stale data: Clear the cache after an icon set update to force the next IconifyProvider call to re-fetch from the API.
cache warm
Fetch a set of icons from the Iconify API and write their SVG content to a local cache directory. Each icon is stored as <cache-path>/<prefix>/<name>.svg.
swarm-icons cache warm --prefix tabler --icons home,star,settings,userFlags
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--prefix |
-p |
string |
Icon set prefix (required) | |
--icons |
-i |
string |
Comma-separated icon names (required) | |
--cache-path |
string |
OS temp dir + /swarm-icons |
Cache directory path | |
--timeout |
-t |
int |
10 |
HTTP request timeout in seconds |
Both --prefix and --icons are required. The command fetches each icon individually from the Iconify API and writes the SVG response to disk.
cache clear
Remove all cached icon files from the cache directory and report the number of files removed and disk space freed.
swarm-icons cache clearClear a cache at a custom path:
swarm-icons cache clear --path ./my-cacheIf the cache directory does not exist, the command prints a message and exits without error.
Flags
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--path |
-p |
string |
OS temp dir + /swarm-icons |
Cache directory path |
Both cache warm and cache clear default to the same directory (<os-temp>/swarm-icons), so clearing removes everything that warming wrote.
See also
- Iconify Provider: the library-side provider that fetches from the Iconify API
- Performance & Caching: caching strategy and provider trade-offs for different deployment scenarios