Posts Self serve Fontawesome icons via icon classes with NextJS
Post
Cancel

Self serve Fontawesome icons via icon classes with NextJS

Install the free version of Font Awesome

You can easily get the latest free version via npm or yarn.

1
2
$ npm install --save @fortawesome/fontawesome-free
$ yarn add @fortawesome/fontawesome-free

Include the css file

Include the css file from node_modules into your _app.js file.

1
import '../node_modules/@fortawesome/fontawesome-free/css/all.min.css';

Use it

Now you can use fontawesome via the icon class, e.g. fas fa-dog.

1
<i className="fas fa-dog" />
This post is licensed under CC BY 4.0 by the author.