npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aurelia-fontawesome

v1.0.0-beta.1

Published

Aurelia wrapper around the font awesome 5 library

Downloads

417

Readme

aurelia-fontawesome

Font Awesome 5 Aurelia component using SVG with JS

Build Status Conventional Commits

Inspired by: react-fontawesome and vue-fontawesome

Installation

Visit fontawesome.com/icons to search for free and Pro icons

$ npm i --save @fortawesome/fontawesome-svg-core

Select one or all icon libraries

$ npm i --save @fortawesome/free-solid-svg-icons
$ npm i --save @fortawesome/free-regular-svg-icons
$ npm i --save @fortawesome/free-brands-svg-icons

Aurelia Plugin

$ npm i --save aurelia-fontawesome

Usage

In your Aurelia bootstrap file, add the plugin:

Zero Configuration

import { PLATFORM } from 'aurelia-framework';

export function configure(aurelia) {
  aurelia.use
    .standardConfiguration()
    .plugin(PLATFORM.moduleName('aurelia-fontawesome'));

  // other code ...

  return aurelia.start().then(() => aurelia.setRoot(PLATFORM.moduleName('app')));
}

Default Configuration

import { PLATFORM } from 'aurelia-framework';

export function configure(aurelia) {
  aurelia.use
    .standardConfiguration()
    .plugin(PLATFORM.moduleName('aurelia-fontawesome'), {
      iconOptions: { /* bindable property defaults here (e.g rotation: 0) */ },,
      icons: [ fab, faCircle, faHome, faSpinner, faCoffee, faMugHot ]
    });

  // other code ...

  return aurelia.start().then(() => aurelia.setRoot(PLATFORM.moduleName('app')));
}

Explicit Import

Explicitly import the icon(s) into your view model(s)

foobar.js

import { faCoffee } from '@fortawesome/free-solid-svg-icons'

export class FooBarViewModel {
  coffeeIcon = faCoffee;
}

foobar.html

<template>
  <font-awesome-icon icon.bind="coffeeIcon"></font-awesome-icon>
</template>

Explicitly importing icons like this allows us to subset Font Awesome's thousands of icons to include only those you use in your final bundled file. for an alternative approach check out webpack loader aurelia-fontawesome-loader

Non FAS icons

foobar.js

export class FooBarViewModel { }

foobar.html

<template>
  <font-awesome-icon icon.bind="['fab', 'apple']"><font-awesome-icon>
  <font-awesome-icon icon.bind="['fab', 'microsoft']"><font-awesome-icon>
  <font-awesome-icon icon.bind="['fab', 'google']"><font-awesome-icon>
</template>

The "check-square" icon is getting a default prefix of fas here too, which is what we want, because that icon also lives in the @fortawesome/free-solid-svg-icons package.

However, the "apple", "microsoft", and "google" brand icons live in the package @fortawesome/free-brands-svg-icons. So we need to specify a different prefix for them—not the default fas, but fab, for Font Awesome

Binding Variations

  • The icon can be an icon object, like icon.bind=${faCoffee}.
  • The icon can be a string, like icon="coffee".
  • The icon can be an Array of strings, where the first element is a prefix, and the second element is the icon name: icon.bind="['fab', 'apple']"
  • The prefix can be bound, the default is fas: prefix="fab" icon="apple"
  • A default prefix can be setup in the plugin configuration: { prefix="fab" }

Dependencies

Building The Code

To build the code, follow these steps.

  1. From the project folder, execute the following command:
npm install
  1. To build the production files, run:
npm run build
  1. You will find the compiled code in the dist folder, available in various module formats.

Running The Tests

To run the unit tests, first ensure that you have followed the steps above in order to install all dependencies and successfully build the library. Once you have done that, proceed with these additional steps:

  1. For single execution run:
npm run test
  1. For continuous tdd style:
npm run test:watch

Running The Examples

  1. From the project folder, execute the following command:
npm start