Skip to content

Instantly share code, notes, and snippets.

@levlaz
Last active October 9, 2023 11:47
Show Gist options
  • Save levlaz/bf1eb985717a24b807dab315d8f81ec9 to your computer and use it in GitHub Desktop.
Save levlaz/bf1eb985717a24b807dab315d8f81ec9 to your computer and use it in GitHub Desktop.
How To Use Font Awesome With Laravel

For some reason there is a whole thread on this seemingly simple tasks. In a bootstrapped Laravel 5.4 instance the following worked for me.

Install Font Awesome with NPM

npm install font-awesome

Import font-awesome in your app.scss file

// resources/assets/sass/app.scss 
// Font Awesome 
@import "node_modules/font-awesome/scss/font-awesome";

Copy fonts to public directory

Add the following to your elixir config in the gulpfile.

.copy('node_modules/font-awesome/fonts', 'public/fonts')

Run Gulp

If you run gulp you should be able to now start using font-awesome everywhere in your app.

@papapadz
Copy link

papapadz commented Nov 9, 2020

In recent Font Awesome versions you need to import the scss files which include the @font-face rules (which have been moved from fontawesome.scss)

@import '~@fortawesome/fontawesome-free/scss/fontawesome';
@import '~@fortawesome/fontawesome-free/scss/brand';
@import '~@fortawesome/fontawesome-free/scss/regular';
@import '~@fortawesome/fontawesome-free/scss/solid';

should @import '~@fortawesome/fontawesome-free/scss/brands';

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