question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't add brand icons...

See original GitHub issue

Following the docs, this is how I add a couple of icons within my NUXT project.

Package.json:

{
  ...
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^1.2.0",
    "@fortawesome/free-brands-svg-icons": "^5.1.0",
    "@fortawesome/free-regular-svg-icons": "^5.1.0",
    "@fortawesome/free-solid-svg-icons": "^5.1.0",
    "@fortawesome/vue-fontawesome": "^0.1.0",
    ...
  }
  ...
}
// nuxt.config.js

export default {
    ...
    plugins: [
        ...
        "~/plugins/font-awesome",
        ...
    ],
    ...
};
// ~/plugins/font-awesome.js

import Vue from "vue";
import { library } from "@fortawesome/fontawesome-svg-core";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";


// icon imports

// works!
import { faThumbsUp as thumbsUp_SolidIcon } from "@fortawesome/free-solid-svg-icons";
library.add (thumbsUp_SolidIcon);

// THE PROBLEMATIC ICON
import { faFacebookF } from "@fortawesome/free-brands-svg-icons";
library.add (faFacebookF);


// register component
Vue.component("font-awesome-icon", FontAwesomeIcon);

Vue.config.productionTip = false;

And this is how I use the icons:

<font-awesome-icon icon="thumbs-up" />
<font-awesome-icon icon="facebook-f" />

I get this error in the console:

Could not find one or more icon(s) {prefix: "fas", iconName: "facebook-f"} {}

And I can clearly see the facebook icon on the correct path and the prefix inside (whatever this prefix actually means as context) is “fab” not “fas”.

Is it possible that nuxt picks up on the .ts file and compiles (transpiles) that incorrectly instead of getting the js file? Edit: just tried referring to the js files directly… don’t know what’s going on with this.

I can’t believe something that was so simple to use previously, would now involve such issues and frustration…

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:7

github_iconTop GitHub Comments

109reactions
nicrotocommented, Jul 20, 2018

Finally figured out what’s going on.

<font-awesome-icon :icon="['fab', 'facebook-f']" />

The boilerplate I need to add 2 icons is larger than starting up an http server…

3reactions
claidecommented, Jun 24, 2019

Additionally, you can use integrated sizing from here.

<font-awesome-icon :icon="['fab', 'github-alt']" size="lg" />

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fontawesome 5 React Brand Icons not working - how to fix it?
What am I missing? I saw someone's advice to import specific objects like - import { faFacebookF } from '@fortawesome/free-brands ...
Read more >
Setting up Brand Kits - Canva Help Center
From the homepage side panel, click Brand. · On the Brand Kit tab, click + Add Brand Kit. · Enter your new Brand...
Read more >
Troubleshooting | Font Awesome Docs
Can I add my own or custom icons to Font Awesome? ... You sure can! We now have the Kit Icon Upload feature...
Read more >
How to Add Font Awesome Icons in React JS - YouTube
In this video, we will go over how to get started with the Font Awesome Icons library in React. ... Your browser can't...
Read more >
How to create and manage a brand in Adobe Express.
Upload your brand assets and apply your fonts, colors, and logos to any project in a single tap. ... Your browser can't play...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found