Install
$ npm install @nuxtjs/fontawesome @fortawesome/free-brands-svg-icons @fortawesome/free-regular-svg-icons @fortawesome/free-solid-svg-icons
package.json
"dependencies": {
"@fortawesome/free-brands-svg-icons": "^5.15.4",
"@fortawesome/free-regular-svg-icons": "^5.15.4",
"@fortawesome/free-solid-svg-icons": "^5.15.4",
"@nuxtjs/fontawesome": "^1.1.2",
"nuxt": "^2.15.7"
}
Files
./build/fontawesome
const solid = [
'faHeart'
]
const regular = [
'faThumbsUp'
]
const brands = [
'faTwitter'
]
export { solid, regular, brands }
nuxt.config.js
import * as FontAwesome from './build/fontawesome'
export default {
buildModules: [
['@nuxtjs/fontawesome', { component: 'fontAwesome', suffix: true }]
],
fontawesome: {
icons: {
solid: FontAwesome.solid,
regular: FontAwesome.regular,
brands: FontAwesome.brands
}
}
}
pages/index.vue
<template>
<div>
<font-awesome-icon :icon="['fas', 'heart']" />
<font-awesome-icon :icon="['far', 'thumbs-up']" />
<font-awesome-icon :icon="['fab', 'twitter']" />
</div>
</template>