I’m trying to restore Heroicons with a new CSS var-
style introduced in 1.7.1 using a script to auto-generate all the functions. The result looks like this, aliased in html_helpers
:
defmodule ProjectWeb.Heroicons do
use Phoenix.Component
import ProjectWeb.CoreComponents
defp concat_name(name, solid, mini) do
"hero-" <>
case solid do
"" ->
case mini do
"" -> name
_ -> name <> "-mini"
end
_ -> name <> "-solid"
end
end
attr :rest, :global,
doc: "the arbitrary HTML attributes for the svg container",
include: ~w(fill stroke stroke-width)
attr :outline, :boolean, default: true
attr :solid, :boolean, default: false
attr :mini, :boolean, default: false
# academic-cap.svg
def academic_cap(assigns) do
~H"""
<.icon name={concat_name("academic-cap", @solid, @mini)} {@rest}/>
"""
end
# ... same for all the rest
and the script generating this posted here: heroicons_gen for Phoenix 1.17.1 · GitHub
Well, of course Tailwind now doesn’t want to recognize any of the attempts to use new Heroicons classes
So for instance, this code:
<Heroicons.x_mark solid class="w-10 h-10 block text-black" />
<Heroicons.academic_cap solid class="w-10 h-10 block text-black " />
The x_mark is seen, since it’s used somewhere else. But the newly generated academic_cap is not.
I’m just hoping to get some insight on how to actually make Tailwind know about such classes, and possibly turn it into a universal approach.