Here's how to user fontawesome in your Rails 7 app with Importmaps.
- Pin fontawesome
Add the following to your config/importmap.rb
file.
pin "@fortawesome/fontawesome-free",
to: "https://ga.jspm.io/npm:@fortawesome/[email protected]/js/all.js"
- Import it in your
app/javascript/application.js
file.
import "@fortawesome/fontawesome-free";
- Use it in your views.
<%= link_to "/" do %>
<i class="fa-sharp fa-solid fa-house"></i>
Click me
<% end %>