Fetches icon data from Iconify sources.
Sources
- NPM - Fetches complete icon sets from
@iconify-json/{prefix}packages - API - Fetches individual icons from api.iconify.design
Examples
# Fetch entire icon set
{:ok, set} = Iconify.Fetcher.fetch_set("heroicons")
# Fetch specific icons
{:ok, icons} = Iconify.Fetcher.fetch_icons("heroicons", ["user", "home"])
Summary
Functions
Fetches a single icon from the Iconify API.
Fetches specific icons from the Iconify API.
Fetches a complete icon set from NPM.
Returns the URL for an icon set's NPM package info.
Functions
@spec fetch_icon(String.t(), String.t()) :: {:ok, Iconify.Icon.t()} | {:error, term()}
Fetches a single icon from the Iconify API.
Examples
{:ok, icon} = Iconify.Fetcher.fetch_icon("heroicons", "user")
@spec fetch_icons(String.t(), [String.t()]) :: {:ok, %{required(String.t()) => Iconify.Icon.t()}} | {:error, term()}
Fetches specific icons from the Iconify API.
Returns a map of icon name to Icon struct.
Examples
{:ok, icons} = Iconify.Fetcher.fetch_icons("heroicons", ["user", "home"])
# => %{"user" => %Icon{}, "home" => %Icon{}}
@spec fetch_set(String.t()) :: {:ok, Iconify.Set.t()} | {:error, term()}
Fetches a complete icon set from NPM.
Downloads the @iconify-json/{prefix} package and parses its icons.json.
Examples
{:ok, set} = Iconify.Fetcher.fetch_set("heroicons")
{:ok, set} = Iconify.Fetcher.fetch_set("mdi")
Returns the URL for an icon set's NPM package info.