Giter Club home page Giter Club logo

fa-custom-icon-demo's Introduction

Font Awesome Custom Icon Demo

This demo using Node.js and Rollup for a build pipeline to create a bundle that is loading in the browser.

If you are using Font Awesome by loading one of our pre-built CDN bundles via <script>, like this...

<script defer src="https://use.fontawesome.com/releases/v5.0.9/js/all.js" integrity="sha384-8iPTk2s/jMVj81dnzb/iFR2sdA7u06vHJyyLlAd4snFpCl/SnyUjRrbdJsw1pGIl" crossorigin="anonymous"></script>

...then here's a CodePen demo that you might find more helpful.

To See This Demo

  1. yarn install
  2. ./node_modules/.bin/rollup -c to build bundle.js from index.js
  3. load index.html in a web browser, and voila

To Make Your Own, Follow the Pattern

  1. Use your favorite tool to create your icon as an SVG.
  2. Copy the svg path data from the d= attribute of the <path> element inside the resulting svg file.
  3. Create and export a plain JavaScript object in your own custom icon pack file similar to the faSplat sample in custom-icon-pack.js.
  4. Paste the svg path data into the same place in that JavaScript object as you see the svg path data in the faSplat sample.
  5. Set the remaining properties of that JavaScript object as follows:
export const faSomeObjectName = {
  // Use a prefix like 'fac' that doesn't conflict with a prefix in the standard Font Awesome styles
  // (So avoid fab, fal, fas, far, fa)
  prefix: string,
  iconName: string, // Any name you like
  icon: [
    number, // width
    number, // height
    string[], // ligatures
    string, // unicode (if relevant)
    string // svg path data
  ]
}

fa-custom-icon-demo's People

Contributors

mlwilkerson avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.