Skip to content

Instantly share code, notes, and snippets.

@tuffs
Last active February 23, 2023 01:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuffs/5e097dfcf75c0533ed9b222616ef1325 to your computer and use it in GitHub Desktop.
Save tuffs/5e097dfcf75c0533ed9b222616ef1325 to your computer and use it in GitHub Desktop.

Add Font-Awesome 4.7 to Rails 7 App

Add the correct NPM package

We will be using the following: fontawesome-4.7 NPM package (https://www.npmjs.com/package/fontawesome-4.7)

yarn add fontawesome-4.7

Import FontAwesome Stylesheets to SCSS

#application.bootstrap.scss

@import "fontawesome-4.7/scss/font-awesome";

If you are using plain CSS, supplement the scss folder with the css folder above.

Make the Web Font Files Available publicly

Copy the fonts folder in ./node_modules/fontawesome-4.7/fonts to ./public folder at the root of your Rails app. When completed you should have ./public/fonts/all_font_files.* available.

Restart server if need be: Ctrl + C , $ ./bin/dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment