Use SAX parser to process SVGs

This commit is contained in:
Max Veytsman
2022-08-31 10:37:29 -04:00
parent 11fcb4183e
commit 05ef2f9a8a
6 changed files with 157 additions and 11 deletions

View File

@ -25,7 +25,19 @@ defmodule Heroicons do
designed to be rendered at 24x24.
"""
use Heroicons.Generator, icon_dir: "outline/"
use Heroicons.Generator,
icon_dir: "outline/",
# Following https://github.com/tailwindlabs/heroicons/blob/b933d51df1f27c35414389fea185e9bac0097481/svgo.24.outline.yaml
svg_opts: [
remove_dimensions: true,
sort_attributes: true,
remove_attributes: ["stroke", "path:stroke-width"],
add_attributes: [
{"stroke-widt", "1.5"},
{"stroke", "currentColor"},
{"aria-hidden", "true"}
]
]
end
defmodule Solid do
@ -36,7 +48,18 @@ defmodule Heroicons do
designed to be rendered at 24x24.
"""
use Heroicons.Generator, icon_dir: "solid/"
use Heroicons.Generator,
icon_dir: "solid/",
# Following https://github.com/tailwindlabs/heroicons/blob/b933d51df1f27c35414389fea185e9bac0097481/svgo.24.solid.yaml
svg_opts: [
remove_dimensions: true,
sort_attributes: true,
remove_attributes: ["fill"],
add_attributes: [
{"fill", "currentColor"},
{"aria-hidden", "true"}
]
]
end
defmodule Mini do
@ -47,6 +70,17 @@ defmodule Heroicons do
designed to be rendered at 20x20.
"""
use Heroicons.Generator, icon_dir: "mini/"
use Heroicons.Generator,
icon_dir: "mini/",
# Following https://github.com/tailwindlabs/heroicons/blob/b933d51df1f27c35414389fea185e9bac0097481/svgo.20.solid.yaml
svg_opts: [
remove_dimensions: true,
sort_attributes: true,
remove_attributes: ["fill"],
add_attributes: [
{"fill", "currentColor"},
{"aria-hidden", "true"}
]
]
end
end