/* Set up using Vue 2 */import Vue from"vue";import App from"./App";/* import the fontawesome core */import{ library }from"@fortawesome/fontawesome-svg-core";/* import font awesome icon component */import{ FontAwesomeIcon }from"@fortawesome/vue-fontawesome";/* import specific icons */import{ faUserSecret }from"@fortawesome/free-solid-svg-icons";/* add icons to the library */
library.add(faUserSecret);/* add font awesome icon component */
Vue.component("font-awesome-icon", FontAwesomeIcon);
Vue.config.productionTip =false;/* eslint-disable no-new */newVue({el:"#app",components:{ App },template:"<App/>",});
Vue 3
/* Set up using Vue 3 */import{ createApp }from"vue";import App from"./App.vue";/* import the fontawesome core */import{ library }from"@fortawesome/fontawesome-svg-core";/* import font awesome icon component */import{ FontAwesomeIcon }from"@fortawesome/vue-fontawesome";/* import specific icons */import{ faUserSecret }from"@fortawesome/free-solid-svg-icons";/* add icons to the library */
library.add(faUserSecret);createApp(App).component("font-awesome-icon", FontAwesomeIcon).mount("#app");
// For Nuxt 2css:["@fortawesome/fontawesome-svg-core/styles.css"];plugins:["~/plugins/fontawesome.js"];
Nuxt.js 3.x
// For Nuxt 3import{ library, config }from"@fortawesome/fontawesome-svg-core";import{ FontAwesomeIcon }from"@fortawesome/vue-fontawesome";import{ fas }from"@fortawesome/free-solid-svg-icons";// This is important, we are going to let Nuxt worry about the CSS
config.autoAddCss =false;// You can add your icons directly in this plugin. See other examples for how you// can add other styles or just individual icons.
library.add(fas);exportdefaultdefineNuxtPlugin((nuxtApp)=>{
nuxtApp.vueApp.component("font-awesome-icon", FontAwesomeIcon,{});});
nuxt.config.ts
// For Nuxt 3exportdefaultdefineNuxtConfig({css:["@fortawesome/fontawesome-svg-core/styles.css"],});