How to add fontawesome 5 in laravel mix

How to add fontawesome 5 in laravel mix


For installing Font Awesome 5 (webfont with css) with Laravel mix we need to install npm first. You can use solution 2 in this post to do that.

After npm installed successfully run code below in your terminal

npm i --save @fortawesome/fontawesome-free

Next import font awesome scss in app.scss or your custom scss file

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

Next compile your assets npm run dev or npm run production and include your compiled css into layout like:

<link href="{{asset('css/app.css')}}" rel="stylesheet">

That's it. Now you can use latest version of fontawesome in your application.

- Last updated 3 years ago

Be the first to leave a comment.

You must login to leave a comment