New to Typescript and vue, I am eager to figure out how I can extract this code from my main.ts file. I'm concerned about it becoming messy as more icons are added.
const app = createApp(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 { faHammer, faTruckPickup, faSortDown } from '@fortawesome/free-solid-svg-icons'
/* add icons to the library */
library.add(faHammer, faMagnifyingGlass, faSortDown)
app.component('font-awesome-icon', FontAwesomeIcon);
My goal is to structure my main.ts file like this (doesn't have to be exact if there is a better approach).
import {addFontAwesomeIcons} from './fontAwesomeLibrary'
const app = createApp(app);
addFontAwesomeIcons(app); //this will use the app object and call library.add() and app.component('font-awesome-icon',FontAwesomeIcon);
To prevent my main.ts file from getting cluttered with additional icons, any assistance on achieving this would be highly appreciated.