thacoon's Blog

Self serve Fontawesome icons via icon classes with NextJS

· thacoon

Install the free version of Font Awesome

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

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

Include the css file

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

1import '../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" />

#frontend #nextjs #react

Reply to this post by email ↪