Skip to content

Font Awesome Pro for Phoenix, Phoenix LiveView and Surface

License

Notifications You must be signed in to change notification settings

carldr/ex_fontawesome_pro

 
 

Repository files navigation

FontAwesome Pro

CI

This package adds a convenient way of using Font Awesome Pro SVGs with your Phoenix, Phoenix LiveView and Surface applications.

You can find the original docs here and repo here.

Current FontAwesome version: 6.2.1

Installation

Add ex_fontawesome to the list of dependencies in mix.exs:

def deps do
  [
    {:ex_fontawesome_pro, git: "https://github.com/carldr/ex_fontawesome_pro"}
  ]
end

Then run mix deps.get.

You then need to get the icons from Font Awesome, so we can build ex_fontawesome_pro :

FONTAWESOME_NPM_AUTH_TOKEN=...token... \
EX_FONTAWESOME_PRO=deps/ex_fontawesome_pro \
mix ex_fontawesome_pro

Replacing ...token... with your token. See https://fontawesome.com/docs/web/setup/packages for details.

Then this is a bit of a hack - you need to remove your _build directory so ex_fontawesome_pro is rebuilt with the icons you've just downloaded.

But once you have, you can compile your app and enjoy pro icons!

Usage

With Eex or Leex

<%= FontAwesomePro.icon("rocket-launch", type: "regular", class: "h-4 w-4") %>

With Heex

<FontAwesomePro.LiveView.icon name="rocket-launch" type="regular" class="h-4 w-4" />

With Surface

<FontAwesomePro.Surface.Icon name="rocket-launch" type="regular" class="h-4 w-4" />

Config

Defaults can be set in the FontAwesomePro application configuration.

config :ex_fontawesome_pro, type: "regular"

License

MIT. See LICENSE for more details.

About

Font Awesome Pro for Phoenix, Phoenix LiveView and Surface

Resources

License

Stars

Watchers

Forks

Languages

  • Elixir 100.0%