tomkr4l / font_awesome5_rails

font_awesome_5_rails is font awesome 5 gem bundled for rails asset pipeline
https://fontawesome.com/
MIT License
158 stars 25 forks source link

Getting 'Cant find stylesheet to import' after new JSBundling Rails 7 install #72

Open jasonfb opened 1 year ago

jasonfb commented 1 year ago

In the "Install with webpack" section could you please clarify the sentence on the README "Next import font in your app/javascript/packs/application.js. You can find more about import in FA pages."

(Please note that I am actually attempting to install this with JSBundling, not webpacker)

Alternatively, please add a section for "Install with JSBundling" instead of webpack.

I searched the (very large and general) FA docs and can find nothing that seems to fit for Rails. Specifically, if you follow the README instructions for a JSBundling app, I get this result:

Screen Shot 2022-11-25 at 10 04 29 PM

my app/assets/stylesheets/application.scss has this:

@import 'bootstrap/scss/bootstrap';
@import 'bootstrap-icons/font/bootstrap-icons';
@import 'font_awesome5_webfont';

The readme says "Next import font in your app/javascript/packs/application.js" (note that in Rails 7 the location is now app/javascript/application.js). This is the part that I'm stuck on. I tried various ways to import font awesome here but I couldn't get any to work.

Can you please clarify the documentation here?

I would suggest removing the link to the general docs because the link only goes to the general docs home page and the information to solve this setup step is not easily identifiable or accessible if you don't already know it.

jasonfb commented 1 year ago

yes my ‘strategy’ (which isn’t much a of a strategy) was using old-style Sprockets for Bootstrap + Font awesome here, but using JSBundling for the javascript. perhaps that’s the problem. I thought that it had to be done this way if Bootstrap was also loaded through Sprockets. Let me experiment with doing it out of Sprockets and get back to this.