How to use Icons like Font Awesome in Gatsby

Jobeso picture Jobeso · Oct 19, 2017 · Viewed 20.6k times · Source

I want to use Font Awesome Icons in my Gatsby project. I would love to include font awesome with a CDN.

Just including it in a script tag doesn't work. I think I need to import it with import ... from '../fontawesome.css' but i am not able to get this working and also wanted to use a cdn for that. Or do I need to parse it with a css library for gatsby?

Please give me advice or hints how to do it.

Answer

sntnupl picture sntnupl · Nov 10, 2018

For anyone visiting this page in late 2018+, I would highly recommend using react-icons.

import { FaBeer } from 'react-icons/fa';

class Question extends React.Component {
    render() {
        return <h3> Lets go for a <FaBeer />? </h3>
    }
}