Getting Font Awesome v5 (Pro) to work with yarn on multiple dev machines

0 Comments

FontAwesome is pretty much the defacto standard icon library these days.

First of all, you'll need your NPM token from your Accounts > Services page.

Following the instructions on the FontAwesome docs (and substitution npm with yarn) you get:

yarn config set @fortawesome:registry https://npm.fontawesome.com/YOUR-TOKEN

Unfortunately this will set the config variable @fortawesome:registry for only your system!

It seems the instructions on their docs for pro support prefer development on a single machine rather than reduce setup for multiple developers. This makes sense in a way since it's easier to get started on a single machine.

If you're fine with that, then we're done here.

But for those wanting a way to set up a project for multiple developers and reduce onboarding, the method below will set the registry for a project with multiple devs.

  • create a .yarnrc file in your project next to package.json
  • paste in the registry into your project .yarnrc:
    "@fortawesome:registry" "https://npm.fontawesome.com/YOUR-TOKEN"
  • (optional) remove @fortawesome:registry from your system
    yarn config delete @fortawesome:registry

Now you should be able to access fontawesome's npm registries via yarn.

yarn add @fortawesome/fontawesome-pro-solid
yarn add @fortawesome/fontawesome-pro-regular
yarn add @fortawesome/fontawesome-pro-light
yarn add @fortawesome/fontawesome-free-brands

Note, this method does assume your token will be inserted into a git repo somewhere. Not a huge security issue since tokens can be revoked via the accounts page.

Other things to do now are:

Sources

 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog