mix ex_icon.gen.icons (ExIcon v0.5.0)

Copy Markdown View Source

Downloads the configured icon libraries and generates the icon modules.

$ mix ex_icon.gen.icons

For every icon set in the configuration file, a module with a function component per icon is generated. An icon set either names a provider and a version, in which case the release of the icon library is downloaded, or a folder that already holds the SVG files.

Releases are cached, so regenerating the icons does not download them again. Paths in the configuration file are relative to the folder the task is run in.

Command line options

  • --cache-dir - the folder to cache the downloaded releases in, defaults to the Mix cache folder
  • --config - the path of the configuration file, defaults to .ex_icon.exs in the folder the task is run in
  • --force - overwrites the generated modules without asking
  • --icon-set - only generates the given icon set, which must be one of the top level keys in the configuration file
  • --refresh - discards the cached releases and downloads them again

The task fails if a module was not written, so that a pipeline that regenerates the icons does not pass with modules that are out of date. Pass --force to write them without being asked.

Examples

Generate all configured icon sets:

$ mix ex_icon.gen.icons

Generate a single icon set and download its release again:

$ mix ex_icon.gen.icons --icon-set lucide --refresh

Regenerate the icons in a pipeline:

$ mix ex_icon.gen.icons --force

Read the configuration from a different path:

$ mix ex_icon.gen.icons --config config/icons.exs