railsbump / app

Check which gems are compatible with which Rails version!
https://railsbump.org
MIT License
152 stars 20 forks source link

Include only the Font Awesome icons that are needed #47

Closed manuelmeurer closed 3 years ago

manuelmeurer commented 4 years ago

We should not include all of Font Awesome but only the ones that are really used, to let Webpack shake the 🌲.

Something like this: (copied from another project)

import { config, library, dom } from '@fortawesome/fontawesome-svg-core'

import {
  faMoneyBill as farMoneyBill
} from '@fortawesome/pro-regular-svg-icons'

import {
  faCalendarAlt as falCalendarAlt
} from '@fortawesome/pro-light-svg-icons'

import {
  faMegaphone    as fasMegaphone,
  faChevronRight as fasChevronRight,
  faMapMarker    as fasMapMarker
} from '@fortawesome/pro-solid-svg-icons'

// https://fontawesome.com/how-to-use/on-the-web/using-with/turbolinks
config.mutateApproach = 'sync'

library.add(
  // Regular
  farMoneyBill,

  // Light
  falCalendarAlt,

  // Solid
  fasMegaphone,
  fasChevronRight,
  fasMapMarker
)

dom.watch()