import awesome library vuejs code example

Example 1: installing fontawesome vue project

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

//inside main.js add
import '@fortawesome/fontawesome-free/css/all.css'     <------
import '@fortawesome/fontawesome-free/js/all.js'    <------
.
.
.
new Vue({  router,  store,  render: h => h(App),}).$mount('#app')


// you can now use the icons anywhere in your project with the 
   
   
   

Example 2: vue font awesome icons

import Vue from 'vue'
import App from './App'
import { library } from '@fortawesome/fontawesome-svg-core'
import { faUserSecret } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'

library.add(faUserSecret)

Vue.component('font-awesome-icon', FontAwesomeIcon)

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  components: { App },
  template: ''
})

Tags:

Misc Example