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,20 @@
defmodule Mix.Heroicons.SvgProcessor do
alias Mix.Heroicons.SvgProcessor.Handler
@moduledoc """
An SVG parser loosly based on https://github.com/svg/svgo
## Options
Currently supports the following options:
* `:remove_dimensions` - remove the `width` and `height` attributes. Defaults to false.
* `:sort_attributes` - sort the svg attributes by name. Default to false.
* `:remove_attributes` - list of attributes to remove
* `:add_attributes` - list of `{"name", "value"}` pairs of attributes to add
"""
def process(svg, opts \\ []) do
{:ok, stack} = Saxy.parse_string(svg, Handler, {[], opts})
Saxy.encode!(stack)
end
end