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.

Icon not working with vue

See original GitHub issue

Based on the user guide, same code, but not working.

import FontAwesomeIcon from '@fortawesome/vue-fontawesome'
export default {
  components: {
    FontAwesomeIcon
  }
}
<button class="btn btn-primary btn-lg btn-block">
    edit
  <font-awesome-icon icon="edit" />
<button>

Threw error in chrome console: Check not find one or more icon(s) {prefix: "fas", iconName: "edit"} {}

neither this would work:

<button class="btn btn-primary btn-lg btn-block">
    edit
  <font-awesome-icon :icon="['fas', 'edit']" />
<button>

Any explanation ? Thanks.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:22
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

10reactions
OriginalEXEcommented, Dec 14, 2017

Check my post here: https://github.com/FortAwesome/vue-fontawesome/issues/14#issuecomment-351474573

Basically, you also need this:

import '@fortawesome/fontawesome/styles.css';
import fontawesome from '@fortawesome/fontawesome';
import { faEdit } from '@fortawesome/fontawesome-free-solid';

fontawesome.config = {
  autoAddCss: false,
};

fontawesome.library.add(faEdit);

This way you only include the icons you will actually use.

3reactions
shaunie2flycommented, Dec 14, 2017

Not sure if this is ideal but it works for me 😃


import fontawesome from '@fortawesome/fontawesome';
import FontAwesomeIcon from '@fortawesome/vue-fontawesome';
import falight from '@fortawesome/fontawesome-pro-light';
import fasolid from '@fortawesome/fontawesome-pro-solid';

fontawesome.library.add(falight, fasolid);

 Vue.component(FontAwesomeIcon.name, FontAwesomeIcon);
Read more comments on GitHub >

github_iconTop Results From Across the Web

vue.js - vuetify icon not showing - Stack Overflow
This is the correct answer! I just did a new Vue-cli project, following the Vuetify quick start and copied one of their templates...
Read more >
Icon not working with Vue component · Issue #75 - GitHub
My component:
Read more >
Troubleshoot | Font Awesome Docs
Having trouble using Font Awesome with Vue? ... it as painless as possible, but you may need to make some changes in your...
Read more >
Font Awesome icons in Vue.js apps: A complete guide
The Font Awesome icon collection is a library of free, easy-to-use icons. In this tutorial, learn to add those icons to your Vue.js...
Read more >
Icons | BootstrapVue
Bootstrap Icons are designed to work with Bootstrap components, from form controls to navigation. Bootstrap Icons are SVGs, so they scale quickly and...
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