font-awesome-esm
v1.0.0
Published
Font Awesome icon library with ES module exports
Maintainers
Readme
Font Awesome Icons Package
A public GitHub package that provides Font Awesome icons as ES modules, compatible with the original Font Awesome import structure.
Installation
Local Development
- Create or edit
.npmrcin your project root:
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
@amoga-org:registry=https://npm.pkg.github.com- Set your GitHub token as an environment variable:
export GITHUB_TOKEN=your_token_here- Install the package:
npm install @amoga-org/font-awesome
# or
yarn add @amoga-org/font-awesome
# or
pnpm add @amoga-org/font-awesomeCI/CD Environments
For GitHub Actions, authentication is automatic. Just use the workflow from our example:
For other CI systems:
- Copy docs/npmrc-template to your project
- Set
GITHUB_TOKENenvironment variable with a GitHub Personal Access Token- Token needs at least
read:packagesscope - Can use organization-wide tokens for CI/CD
- Token needs at least
Usage
Import icons exactly like you would with Font Awesome Pro:
import {
faAlignCenter,
faArrowRightToLine,
faChevronDown,
} from "@amoga-org/font-awesome/icons/classic/light";
import {
faHeart,
faUser,
faHome,
} from "@amoga-org/font-awesome/icons/classic/solid";
import {
faFacebook,
faTwitter,
faGithub,
} from "@amoga-org/font-awesome/icons/brands";Available Styles
- Classic Light:
@amoga-org/font-awesome/icons/classic/light - Classic Regular:
@amoga-org/font-awesome/icons/classic/regular - Classic Solid:
@amoga-org/font-awesome/icons/classic/solid - Brands:
@amoga-org/font-awesome/icons/brands - Duotone:
@amoga-org/font-awesome/icons/duotone - Sharp Light:
@amoga-org/font-awesome/icons/sharp-light - Sharp Regular:
@amoga-org/font-awesome/icons/sharp-regular - Sharp Solid:
@amoga-org/font-awesome/icons/sharp-solid - Thin:
@amoga-org/font-awesome/icons/thin
Icon Structure
Each icon is an object with the following structure:
{
prefix: 'fal', // Style prefix (fal, fas, far, fab, etc.)
iconName: 'align-center', // Original kebab-case name
icon: [ // Icon data array
448, // Width
512, // Height
[], // Ligatures (empty)
'', // Unicode (empty)
'M112 48c-8.8 0...' // SVG path data
]
}TypeScript Support
The package includes full TypeScript definitions:
import { IconDefinition } from "@amoga-org/font-awesome";
import { faAlignCenter } from "@amoga-org/font-awesome/icons/classic/light";
const icon: IconDefinition = faAlignCenter;Building
To build the package from SVG source files:
npm run buildThis will:
- Process all SVG files in the
icons/directory - Generate JavaScript modules with named exports
- Create TypeScript definition files
- Output everything to the
dist/directory
File Structure
├── icons/ # Source SVG files
│ ├── light/ # Light style icons
│ ├── regular/ # Regular style icons
│ ├── solid/ # Solid style icons
│ └── brands/ # Brand icons
├── dist/ # Built JavaScript modules
│ └── icons/
│ ├── classic/
│ │ ├── light/
│ │ ├── regular/
│ │ └── solid/
│ └── brands/
├── scripts/ # Build scripts
└── package.json # Package configurationContributing
- Add SVG files to the appropriate directory in
icons/ - Run
npm run buildto generate the modules - Test imports with
npm test - Submit a pull request
License
MIT License - see LICENSE file for details.
Font Awesome
This package is inspired by Font Awesome but is independent. Font Awesome is a trademark of Fonticons, Inc.
