Import all icons from Fontawesome

Vladimir Humeniuk picture Vladimir Humeniuk · Apr 17, 2018 · Viewed 7.2k times · Source

I using Fontawesome 5 in my Angular project in this way:

import fontawesome from '@fortawesome/fontawesome';
import { faBold, faItalic, faUnderline } from '@fortawesome/fontawesome-free-solid';

and in contructor:

fontawesome.library.add(faBold, faItalic, faUnderline)

But it's very silly to import each icon separately. Can I somehow import all the icons at once?

upd: import * as icons ... does not work.

Answer

sr9yar picture sr9yar · Apr 18, 2018
import { fas } from '@fortawesome/fontawesome-free-solid';

and then

fontawesome.library.add(fas)

same for other styles

import { fab } from '@fortawesome/fontawesome-free-brands';
import { far } from '@fortawesome/fontawesome-free-regular';
...
fontawesome.library.add( fab, far );