GSP
GSP

Reputation: 3789

FontAwesome Pro in Rails 8 with importmap and propshaft

I am having a difficult time getting FontAwesome Pro to work with propshaft, importmap and other Rails 8 changes.

I'm using tailwindcss 3 with an assets directory that looks like:

app
  assets
    builds
      tailwind.css
    stylesheets
      application.css
      application.tailwind.css

My application head looks like:

!!!
%html
  %head
    %meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
    %title ActivityTracker
    %meta{:content => "width=device-width,initial-scale=1", :name => "viewport"}/
    = csrf_meta_tags
    = csp_meta_tag
    = stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload"
    = stylesheet_link_tag :app, "data-turbo-track": "reload"
    = javascript_importmap_tags

My first attempt to use the font-awesome-pro-sass gem provided by Font Awesome, seemed to have a conflict between the expectation of application.scss and application.css and I could not find the correct edits to make it work.

My current attempt adds the fontawesome directory directly to my app javascripts directory (e.g. app/javascript/fontawesome-pro-6.7.2-web ) and pins it in the importmap config (e.g. pin "@fortawesome/fontawesome-pro", to: "fontawesome-pro-6.7.2-web/js/all.js" )

It works in my local machine but is insanely slow and doesn't appear to work at all when I deploy it to a server (using kamal 2).

Upvotes: 0

Views: 117

Answers (1)

sirop_erable
sirop_erable

Reputation: 1

I am having the same problem, for now I fixed the issue by adding a fixed library. I found this solution in a prior thread, but I'm not sure if it will works with the pro version.

Here: https://stackoverflow.com/a/78348023/20932911

<link rel="stylesheet" href="https://site-assets.fontawesome.com/releases/v6.5.2/css/all.css" />

Upvotes: 0

Related Questions