Files
go_nuxt_admin/app/plugins/fontawesome.ts
Beyhan Oğur 5285a0dd86 first commit
2026-04-26 22:07:47 +03:00

40 lines
889 B
TypeScript

// SSR-friendly Font Awesome plugin
// Registers the Vue component and a small set of icons so server-render and client-render match.
import { library } from '@fortawesome/fontawesome-svg-core'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
// Import a conservative set of icons used in the admin UI
import {
faHouse,
faUsers,
faCogs,
faNewspaper,
faTags,
faHashtag,
faRightFromBracket,
faPlus,
faWandMagic,
faGaugeHigh,
faShieldAlt
} from '@fortawesome/free-solid-svg-icons'
export default defineNuxtPlugin((nuxtApp) => {
// Add selected icons to the library
library.add(
faHouse,
faUsers,
faCogs,
faNewspaper,
faTags,
faHashtag,
faRightFromBracket,
faPlus,
faWandMagic,
faGaugeHigh,
faShieldAlt
)
// Globally register component
nuxtApp.vueApp.component('FontAwesomeIcon', FontAwesomeIcon)
})