To kick things off, start by installing it through NPM :
npm install @fortawesome/fontawesome-free --save-dev
You now have a couple of options: either embed the absolute URL in your HEAD section or, if you're using something like SASS(SCSS), import it into your custom.scss file as shown below:
- Begin by setting an absolute path for the webfonts (make sure to do this before importing fontawesome.scss) :
$fa-font-path: "node_modules/@fortawesome/fontawesome-free/WebFonts" !default;
- Next, import fontawesome.scss :
@import "node_modules/@fortawesome/fontawesome-free/scss/fontawesome";
- Lastly, import the regular, solid, or light (pro version) icon types:
@import "node_modules/@fortawesome/fontawesome-free/scss/regular";
Once that's all set up, you can apply font-family to these classes to start using them:
.fa,.fas,.far,.fal,.fab {
font-family: "Font Awesome 5 Free";
}