CLI Reference
All CLI commands are exposed via the bin/iconmap binstub added by iconmap:install.
pin
Pin icons (single or multiple):
./bin/iconmap pin @fortawesome/fontawesome-free/svgs/brands/github.svgIf you include @<version> in the package name, that version is used. Otherwise, Iconmap resolves the latest version via jsdelivr.
Examples:
./bin/iconmap pin @fortawesome/fontawesome-free/svgs/brands/github.svg
./bin/iconmap pin @fortawesome/fontawesome-free@6.7.0/svgs/brands/github.svg
./bin/iconmap pin some-package/icons/logo.svg another-package/icons/x.svgReal example — Font Awesome GitHub brand icon
# pin the latest
./bin/iconmap pin @fortawesome/fontawesome-free/svgs/brands/github.svg
# pin a specific version
./bin/iconmap pin @fortawesome/fontawesome-free@6.7.0/svgs/brands/github.svgThe vendored file will appear in vendor/icons/ with a flattened filename, for example:
@fortawesome--fontawesome-free--svgs--brands--github.svgRecommended: render the SVG inline using the inline_svg gem (https://github.com/jamesmartin/inline_svg):
<%= inline_svg_tag '@fortawesome--fontawesome-free--svgs--brands--github.svg', class: 'icon' %>Or reference via the asset pipeline:
image_tag asset_path('@fortawesome--fontawesome-free--svgs--brands--github.svg'), alt: 'GitHub'unpin
./bin/iconmap unpin @fortawesome/fontawesome-free/svgs/brands/github.svgRemoves the pin and deletes the vendored file.
Note: unpin only removes the vendored SVG matching the pin and the pin line in config/iconmap.rb; it does not modify other pins that reference the same npm package.
outdated
./bin/iconmap outdatedChecks the registry/CDN for newer package versions and prints a table of outdated icons.
Exit codes: 0 when nothing is outdated, 1 when at least one pinned icon is outdated, 2 on fatal errors.
update
./bin/iconmap updateUpdates all outdated pins: downloads new files and updates config/iconmap.rb.
You can also update a single pin by passing it explicitly, e.g. ./bin/iconmap update @fortawesome/fontawesome-free/svgs/brands/github.svg.
pristine
./bin/iconmap pristineRe-downloads every pinned icon from the CDN and replaces vendored files.
Useful when vendored files were omitted from source control or when switching branches with different pins.
audit
./bin/iconmap auditPerforms a security audit against the npm advisories API for the pinned package versions.
The command exits with status 1 if vulnerabilities are found; read the printed table for details on severity and affected versions.
packages
./bin/iconmap packagesLists all pinned packages and their pinned versions.
Output format: <package> <resolved-version> <pin-path> per line, which makes it easy to parse in scripts.