Font-awesome: How to install for angular ?

Created on 2 Jul 2018  路  4Comments  路  Source: FortAwesome/Font-Awesome

Hi,

I cant make icon appear using local node_modules files

I installed this :

npm install --save-dev @fortawesome/fontawesome-free

my .angular-cli.json :

 "styles": [
        "styles.css",
         "../node_modules/node_modules/@fortawesome/fontawesome-free/css/all.css",
      ],
      "scripts": [
        "../node_modules/node_modules/@fortawesome/fontawesome-free/js/all.js",
      ],

no icon are apprearing

but it works using this :

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">

so why is it not working with local files ????

regards

question waiting for feedback

Most helpful comment

I added all styles in angular.json and it worked
"styles": [ "node_modules/@fortawesome/fontawesome-free/scss/fontawesome.scss", "node_modules/@fortawesome/fontawesome-free/scss/regular.scss", "node_modules/@fortawesome/fontawesome-free/scss/solid.scss", "node_modules/@fortawesome/fontawesome-free/scss/brands.scss", "src/styles.scss" ]

All 4 comments

Just a guess. Maybe you have to copy node_modules/@fortawesome/fontawesome-free/webfonts/ to your project folder.

Example directory structure:

  • project/css/
  • project/webfonts/
    ...

And your include looks weird "../node_modules/node_modules/...". Double "node_modules"?

Hi!

Thanks for being part of the Font Awesome Community.

I'm not an angular developer

 "styles": [
        "styles.css",
         "../node_modules/node_modules/@fortawesome/fontawesome-free/css/all.css",
      ],
      "scripts": [
        "../node_modules/node_modules/@fortawesome/fontawesome-free/js/all.js",
      ],

I think this is wrong, this is loading both css and js version. You should choose one of them.

Please take a look here: https://fontawesome.com/how-to-use/on-the-web/using-with/angular

let me know if that helps

I added all styles in angular.json and it worked
"styles": [ "node_modules/@fortawesome/fontawesome-free/scss/fontawesome.scss", "node_modules/@fortawesome/fontawesome-free/scss/regular.scss", "node_modules/@fortawesome/fontawesome-free/scss/solid.scss", "node_modules/@fortawesome/fontawesome-free/scss/brands.scss", "src/styles.scss" ]

I'm going to close here, feel free to comment if this is still an issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sebastialonso picture sebastialonso  路  178Comments

bhubbard picture bhubbard  路  169Comments

roysbailey picture roysbailey  路  170Comments

ivafrydkova picture ivafrydkova  路  176Comments

vivekagr picture vivekagr  路  194Comments