Font-awesome: Which files do i need from npm package

Created on 2 Jan 2018  路  5Comments  路  Source: FortAwesome/Font-Awesome

Hi,

I installed FontAwesome5 via npm. Now i have the following structure in node_modules:

  • @'fortawesome

    • fontawesome

    • fontawesome-free-brands

    • fontawesome-pro-light

    • fontawesome-pro-regular

    • fontawesome-pro-solid

Which files do i need from those folders if i want to use all icons? Please also explain those folders because the "fontawesome" folder includes js and css but no fonts and no svg's in js.
The other folder include index.js and shakable.js. What is shakable.js?

thanks and best wishes,
Patrick

Most helpful comment

@eberhapa I was able to pull in the entire library with the following:

import fontawesome from '@fortawesome/fontawesome'
import brands from '@fortawesome/fontawesome-free-brands'
import light from '@fortawesome/fontawesome-pro-light'
import regular from '@fortawesome/fontawesome-pro-regular'
import solid from '@fortawesome/fontawesome-pro-solid'

fontawesome.library.add(brands, light, regular, solid)

Then just make sure that you're compiled javascript file is included. The javascript will search for the correct classes and then make the switch to SVG for you.

Doing it this way, and not specifying which icon from the packs, will significantly bloat your compiled javascript and is not recommended for a production environment. Instead, if you do this for development, just keep track of which icons you end up using and selectively call those in.

All 5 comments

Hi!

Thanks for being part of the Font Awesome Community.

Does this help?

https://fontawesome.com/how-to-use/use-with-node-js

Thanks @tagliala but no. I've read the documentation before and it's still ned 100% clear for me.

@eberhapa I was able to pull in the entire library with the following:

import fontawesome from '@fortawesome/fontawesome'
import brands from '@fortawesome/fontawesome-free-brands'
import light from '@fortawesome/fontawesome-pro-light'
import regular from '@fortawesome/fontawesome-pro-regular'
import solid from '@fortawesome/fontawesome-pro-solid'

fontawesome.library.add(brands, light, regular, solid)

Then just make sure that you're compiled javascript file is included. The javascript will search for the correct classes and then make the switch to SVG for you.

Doing it this way, and not specifying which icon from the packs, will significantly bloat your compiled javascript and is not recommended for a production environment. Instead, if you do this for development, just keep track of which icons you end up using and selectively call those in.

@eberhapa does this address your question?

Sorry, I was busy and got no notification. Yes, it's clear now. Thats the way to use it with ES. Without ES I just need the fontawesome.min.js and the [regular/brands/solid/light].js files or the fontawesome-all.min.js. Thanks for helping out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tdolph picture tdolph  路  3Comments

yarcowang picture yarcowang  路  3Comments

lickmydesign picture lickmydesign  路  3Comments

daneren2005 picture daneren2005  路  3Comments

huuphat picture huuphat  路  3Comments