Last active
December 26, 2018 18:36
-
-
Save chrfs/78af2f34e2e21d975e7aab7c545e7990 to your computer and use it in GitHub Desktop.
VueJS FontAwesomeIcon load all Icons
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vue from 'vue' | |
import { library } from '@fortawesome/fontawesome-svg-core' | |
import * as faIconsSolid from '@fortawesome/free-solid-svg-icons' | |
import * as faIconsRegular from '@fortawesome/fontawesome-free-regular' | |
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' | |
const loadFontAwesomeIcons = (fontAwesomeIcons) => { | |
Object.keys(fontAwesomeIcons).forEach(faIconName => { | |
if (faIconName.startsWith('fa') && fontAwesomeIcons[faIconName].iconName) { | |
library.add(fontAwesomeIcons[faIconName]) | |
} | |
}) | |
} | |
loadFontAwesomeIcons(faIconsSolid) | |
loadFontAwesomeIcons(faIconsRegular) | |
Vue.component('font-awesome-icon', FontAwesomeIcon) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment