Pregenerate the icons with a mix task

This commit is contained in:
Max Veytsman
2022-08-31 16:41:05 -04:00
parent 9c6dafbd81
commit 093383a73a
12 changed files with 35681 additions and 197 deletions

View File

@ -0,0 +1,19 @@
defmodule Mix.Heroicons.GeneratorHelpers do
alias Mix.Heroicons.SvgProcessor
def icon_name(path) do
Path.basename(path, ".svg")
|> String.replace("-", "_")
|> String.to_atom()
end
def icon_body(path, svg_opts) do
icon =
File.read!(path)
|> SvgProcessor.process(svg_opts)
<<"<svg ", body::binary>> = icon
body
end
end