How to add FontAwesome to you web project

Install the new dependency in the project FontAwesome, a well known icon library.

To install this library execute the following command:

$ npm install --save @fortawesome/fontawesome-free

As is explained in its documentation.

Now that the dependency is installed we need to use it in the project.

Open the file src/index.html with your preferred text editor and add the following snippet whenever you want:

<i class="fas fa-home"></i>

Now we just need to add FontAwesome dependencies already installed to our bundle. Open file src/assets/…/main.scss and add the following import code:

@import "npm:@fortawesome/fontawesome-free/css/all.css";

That’s all!

Deja una respuesta