Add Fontawesome Pro to Your Laravel Project Using Npm

If you want to add Fontawesome 5 Pro to your Laravel project using npm, first create a file .npmrc in your project root. Content of this file should be:

@fortawesome:registry=https://npm.fontawesome.com/
//npm.fontawesome.com/:_authToken=YOUR-TOKEN

Make sure to replace YOUR-TOKEN by your personal Fontawesome 5 Pro token.

Then, run:

npm install --save-dev @fortawesome/fontawesome-pro

Add the following lines to your resources/assets/sass/app.scss (or skip not wanted types):

@import "node_modules/\@fortawesome/fontawesome-pro/scss/fontawesome.scss";
@import "node_modules/\@fortawesome/fontawesome-pro/scss/light.scss";
@import "node_modules/\@fortawesome/fontawesome-pro/scss/regular.scss";
@import "node_modules/\@fortawesome/fontawesome-pro/scss/solid.scss";

Now, in development mode run:

npm run dev

Or in production mode, run:

npm run production

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top