Using a Package Manager
For those using
npm
,yarn
, orpnpm
package managers, you can use the Font Awesome packages to keep your project up-to-date with the latest icons and improvements.
We’ll cover the basics of choosing the package that best suits your needs, access configuration, and tips adding and using icons.
We have a few package groups available:
Package | What’s in it | What’s it good for |
---|---|---|
Kit Package New! | Whatever you put in your Kit - custom icons, a subset of Font Awesome icons and styles - and nothing else. | Customizing your package |
pro-*-svg-icons | JavaScript-based Classic family SVG icon packages. | Using with our JavaScript API or JavaScript components |
sharp-*-svg-icons | JavaScript-based Sharp family SVG icon packages. | Using with our JavaScript API or JavaScript components |
free-*-svg-icons | JavaScript-based Free and Brands SVG icon packages. | Using with our JavaScript API or JavaScript components |
fontawesome-pro | All the Version 6 goodness including all the latest features and Pro icons, spanning 5 styles available in 2 families, Classic and our new Sharp. And there’s our Brands icon family on top of that too. | Getting CSS, webfonts, Sass & Less, and SVG assets in an npm package |
fontawesome-free | All the Version 6 goodness but just the Free icons | Open Source projects |
Basically, the packages contain all the stuff in the Font Awesome for Web download or when downloading a Font Awesome Kit, but bundled as a package. Pick the one that suits your project and follow the steps below to get set up.
1. Configure Pro Package Access
If you plan to use the Pro packages, which contain more icons and styles, you’ll need to have an active subscription to a Pro Plan and a valid Pro Package Token and then follow the steps below to configure Pro access for your project.
Your package token gives you access to our registry, npm.fontawesome.com
. In the next steps we’ll configure specific NPM scopes to use this registry.
Kit or Font Awesome packages: Which Do I Use?
Kit Packages are our recommendation. You can pick only the styles or individual icons you use and even upload your own icons. They are custom-built to your needs. Head to Your Kits to create one if you have a Pro subscription.
Our Font Awesome packages contain only Font Awesome official icons. They are not subsetted, so they are larger downloads.
Project-specific Using Configuration Files
This per-project setup lets you configure each project individually, which can be good for teams and CI/CD.
To authenticate when using npm, pnpm, or yarn v1, create a .npmrc
file in the root
of your project (or wherever your package.json file lives). For yarn v2 (or
later) you will need to create a .yarnrc.yml
file. Then add one of the
following snippets to the file.
For Kit Packages
If you’ve subsetted a Kit or uploaded icons to a specific Kit and want to use those through a package manager, add this to your package manager configuration.
For Font Awesome Packages
Can I do both?
Yep. You can specify both @awesome.me
and @fortawesome
in the same config files. This is useful if you
are in the process of migrating to the newer Kit Packages.
Using Environment Variables
A more secure way to configure your .npmrc
or .yarnrc.yml
files is with
environment variables. This can help prevent tokens leaking and make token
rotation easier (should you need to perform it).
While your .npmrc
or .yarnrc.yml
is normally checked in to your source code
repository, environment variables values should not be. Using environment variables
for your token is a way to keep from checking it in to your source code
repository, which prevents it from being shared with others who should not have
it.
This example uses FONTAWESOME_PACKAGE_TOKEN
as the environment variable name.
Basic Authentication for Proxys
If you’re using a proxy, you can use basic authentication in your .npmrc file.
2. Install Your Package
There are three options to for installing the Font Awesome packages:
Install | What You Get |
---|---|
Kit Package New! | Your custom icons, icon styles or individual icons you choose in a variety of formats. This is our recommended choice for most projects. |
SVG icon packages | JavaScript-based packages named by family and style. If Kits aren’t for you this lets you use our Javascript API, a Javascript component, and tree-shaking. Follow the steps for Javascript API for this installation. |
All The Things | The Free and Pro packages include not only the icons in all the styles, but also all the supporting files to make them render. We do not recommend using this package. This package closely resembles what you get from our Downloads page. You have a lot of options with this package but it’s also the largest. |
Kit Package
If you’re using a Kit, you can install a Kit Package with the following command - just make sure to replace KIT_CODE
with your specific Kit’s ID:
Or if you’re using environment variables, you can do this instead:
SVG Icon Packages
The Pro Packages
Or if you’re using environment variables, you can do this instead:
The Free Packages
All The Things
The Pro Package
Once you have global or per-project access setup, you can install the Version 6 Pro package via npm or yarn:
Or if you’re using environment variables, you can do this instead:
The Free Package
If you need just the Free icons, we have a slimmed-down free-only package for that. Install with this command:
3. Pick Your Method and Add Icons
You’re all set to use Font Awesome packages in your project. Here are some common options:
4. Cache Your CI Dependencies
Tune your CI to keep your bandwidth usage low. We’ll show you how.
5. Troubleshooting Your Configuration
Supported Package managers
Font Awesome supports the following package managers:
- npm
- Classic yarn (1.x)
- Modern yarn (2.x+)
- pnpm
Private and Public npm Repositories
Repository | Public | Require active Pro subscription | Kit Package | Font Awesome Pro | Font Awesome Free |
---|---|---|---|---|---|
https://npm.fontawesome.com | |||||
https://registry.yarnpkg.com | |||||
https://registry.npmjs.org |
Note: To use the Private npm Repository, an active subscription to Font Awesome Pro is required.
Configuration Troubleshooting Commands
Use the following commands to get configuration information for your package manager:
- npm:
npm config list
- Classic yarn:
yarn config list --verbose
- Modern yarn:
yarn config --why
(pay attention tonpmScopes
entry) - pnpm:
pnpm config list
(pay attention to theconfig from
section)
Use the Private Repository
If your application needs to use the private repository, ensure that credentials are set:
npm
example output
Classic yarn
example output
Modern yarn
example output
pnpm
example output
Token in environment variable
Make sure that the environment variable is available and readable by the
package manager, this may be the cause of authentication issues on remote
servers. You’ll see 4xx
HTTP status codes if this is the case.
Switching from Private to Public Repository (and vice versa)
When switching from the Private Repository to the Public Repository, remove the
currently installed Font Awesome packages from the lock file. The specific
command to do this depends on the package manager you are using (yarn
or
npm
). If you are brave enough, you can hand-edit these files.