Skip to content

draftbit/re-font-awesome

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Apr 21, 2025
8798c9d · Apr 21, 2025

History

48 Commits
Nov 7, 2022
Jan 4, 2021
Nov 7, 2022
Apr 21, 2025
Nov 6, 2022
Nov 6, 2022
Nov 6, 2022
Nov 6, 2022
Nov 7, 2022
Apr 21, 2025
Nov 6, 2022
Sep 18, 2024

Repository files navigation

Font Awesome in Rescript

Usage

// Free libraries
<FontAwesome.Icon icon=FontAwesome.FreeRegular.faCheck />
<FontAwesome.Icon icon=FontAwesome.FreeSolid.faXRay className="MyIcon" />

// Pro libraries (requires a font-awesome token, see below)
<FontAwesome.Icon
  icon=FontAwesome.Duotone.faBanjo
  className="PrimaryIcon"
/>

<FontAwesome.Icon icon=FontAwesome.Light.faHockeyPuck />

Installation & dependencies

This library uses optional dependencies for the individual font libraries, so make sure you include the ones you want to use in your project. For example:

$ yarn add '@fortawesome/pro-regular-svg-icons@^5'
$ yarn add '@fortawesome/free-solid-svg-icons@^5'

NOTE: In order to use the -pro libraries you must have a token for font awesome in your .npmrc. As an example:

@fortawesome:registry=https://npm.fontawesome.com/
//npm.fontawesome.com/:_authToken=XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX

Generate the binding files

The reason bindings for each font style are generated by a script genbindings.js, which you can run directly or with:

yarn gen-icon-bindings

This should be run any time the FontAwesome version changes, to keep the list of icons up to date.

Preview Example

A small React application is provided to preview the icons and serve as an example of how to use the components. Its code lives in the example directory. It can be run with yarn example:start and will be run on port 1234 by default.

Compiler Commands

yarn re:clean
yarn re:build
yarn re:watch