Font Awesome Pro¶
If you have an active Font Awesome Pro subscription1, you can use it with RIL in just two easy steps.
First, enable Font Awesome Pro via the fontawesome.pro_enabled
setting.
fontawesome.pro_enabled
: Controls whether Font Awesome Pro is enabled.
fontawesome.pro_enabled
controls whether RIL allows the use of icons exclusive to Font Awesome Pro.
Second, set the FONTAWESOME_PACKAGE_TOKEN
environment variable to your
Font Awesome package token.
FONTAWESOME_PACKAGE_TOKEN
: Your Font Awesome package token.
A Font Awesome package token enables access to Font Awesome's private, Pro-only, package registry.
This special setting can only be configured via an environment variable or .env
file and is not prefixed
with RIL_
.
That's it — you can now use Pro icons without any further setup.
Using a Kit¶
Kits are all-in-one management utilities for Font Awesome icons. You can read more about them at Font Awesome's documentation.
There is literally no downside to using a Kit
Using a Kit helps you save on registry bandwith and allows you to use custom icons. It also means RIL's Font Awesome component introduces only three Node.js dependencies to your project instead of up to 18.
Kits should be always be preferred over plain Font Awesome Pro.
Setup¶
First, follow the instructions above to set up Font Awesome Pro.
Second, choose the Kit you want to use (or create a new one), head into its settings, and ensure Features > Enable Installing Your Kit as a Package is checked.
Third, find your Kit code. Use the image below as a reference.
Finally, set the fontawesome.kit_code
setting to your Kit code.
fontawesome.kit_code
: A Font Awesome Kit code.
Setting fontawesome.kit_code
allows you to use the corresponding Kit with RIL.
Your Kit code is not a secret and is safe to commit to version control or share with other people.
Protecting your Kit from unauthorized use
It is strongly recommended that you set at least one allowed domain for your Kit. If you don't set any, anyone with your Kit code will be able to use your Kit via Font Awesome's CDN and your pageviews might unexpectedly go through the roof.
You can use your own domain if you have one, or example.com
if you don't.
This setting has absolutely no effect on RIL regardless of where your Reflex project is hosted.
Using custom icons¶
You can use custom icons via fa.kit()
.
Duotone custom icons are unavailable for now
Duotone custom icons are currently not available in Kit packages, so you can't use them with RIL. This is a limitation on Font Awesome's side, so you'll have to wait for things to change on their end.
Updating Kits¶
If you add, remove, or edit icons or styles in your Kit, you can get those changes in your Reflex project by having Reflex reinstall your project's frontend packages:
Continous integration¶
If you plan to build your Reflex project in a continuous integration environment, you are strongly advised to cache your dependencies in order to preserve your registry bandwith.
Do I need to worry about this?
This only applies to users who are statically building their project with reflex export
in a CI
environment. If you're unsure whether that's you, it probably isn't.
Your cache should save the entire .web
directory and be keyed on both .web/bun.lockb
and .web/package-lock.json
. (1)
- If the
REFLEX_WEB_WORKDIR
environment variable is set, use its value in place of.web
.
Below are links to the relevant documentation for several popular CI providers:
Using alternate registries (advanced)¶
You can use the fontawesome.npm_registry
setting to specify an alternate registry from which
to install Font Awesome Pro packages. The registry must implement the
CommonJS package registry specification.
This is an advanced capability that most users won't need.
fontawesome.npm_registry
: Controls where Reflex will install Font Awesome Pro packages from.
fontawesome.npm_registry
controls the registry from which Reflex will install packages in the @fortawesome
and @awesome.me
namespaces.
Don't open any issues if you use this setting
If you set the fontawesome.npm_registry
setting to anything other than its default of https://npm.fontawesome.com
,
don't open any Font Awesome-related issues in RIL's repository. You will be asked for information that will
reveal you have configured this setting, at which point your issue will be closed without further response.
Troubleshooting¶
"Incorrect or missing password" error¶
If you're trying to use Font Awesome Pro icons and NPM emits an error like:
It's probably because your Font Awesome package token is incorrect or missing. You should:
- Double-check that the token matches the one on your Font Awesome account page.
- Make sure your token is exposed by the
FONTAWESOME_PACKAGE_TOKEN
environment variable. Casing doesn't matter, but the spelling must otherwise be exact. There are no alternative ways of setting a token — trying to put it in apyproject.toml
orril.toml
file won't work.- If you're using a
.env
file, make sure it's located in the current working directory — i.e., the directory in whichreflex run
orreflex export
is being executed. Also, make sure it's named.env
exactly.
- If you're using a
If things still aren't working, open an issue.
-
You must be actively paying for Font Awesome Pro. A perpetual fallback license won't cut it. ↩