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

awesomify-svgs

v0.2.4

Published

Convert SVGs to Font Awesome 5 supported js object format

Downloads

7

Readme

awesomify-svgs pipeline statuscoverage report

Convert a directory with SVGs to a Font Awesome 5 supported js data object format. Warning, this package is currently experimental. Use it at your own risk!

CLI

For minimal hassle use cases.

awesomify-svgs --help

  Usage: cli [options] <source directory> [target directory]

  Converts SVGs in a directory to Font Awesome 5 supported js data object format.
Examples:

Convert SVGs from /example-icons to /dist without any grouping:
> awesomify-svgs example-icons

Some designers prefer to create the same icon multiple times with different detail levels.
Eg. user-16.svg is ideal for 16px size while user-32 has more details. Setting --has-variant with
the appropriate separator reults in [icon]-all.js files to be generated with imports to all variant:
> awesomify-svgs --has-variant example-icons

Sometimes certain SVG variants might be missing. Awesomify can be set to generate fallbacks with the
--ensured-variants option. Eg. To make sure [icon]-16, [icon]-32 and [icon]-48 are always ready to import:
> awesomify-svgs --has-variant --ensured-variants "16, 32, 48" example-icons


  Options:

    -V, --version                                    output the version number
    -D, --no-deep                                    ignore sub-directories
    -f, --format [name]                              Font Awesome format version: accepts "latest", "v5-cjs", "v5-esm" (default: "latest")
    -n, --namespace [name]                           Prepending the prefix, used as a namespace for UMD bundled index.js files. (default: "Awesomified")
    -a, --auto-scale                                 Enables auto-scaling viewBox and path coordinates to 512 units
    -c, --clean                                      cleans target directory first
    -p, --prefix [name]                              sets icon prefix (default: "the")
    -v, --has-variant [separator]                    use naming convention of [name][separator][variant] (default: -)
    -e, --ensured-variants [variant 1]..[variant n]  comma separated icon variants to always generate (default: [])
    -h, --help                                       output usage information

Node API

Use to gain better control over the behavior.

/** Converts SVG icons in a dir to a FontAwesome compliant icon pack. */
export function awesomifySvgs(options?: AwesomifyOptions): Promise<Array<Promise<void>>>;

type AwesomifyOptions = {
  /** Relative or absolute path to SVGs to convert. Defaults to "icons". */
  source?: string,
  /** Relative or absolute path to target directory. Defaults to "dist". */
  target?: string,
  /** Output FontAwesome format to use. Defaults to "latest". */
  format?: FontAwesomeFormat,
  /** Prepending the prefix, used as a namespace for UMD bundled index.js files. Defaults to "Awesomify". */
  namespace?: string,
  /** Opts into auto-scaling viewBox and path coordinates to 512. Defaults to false. */
  autoScale?: boolean,
  /** Deep scan (recursively) the source directory for icons. Defaults to true. */
  deep?: boolean,
  /** Wipe target first. Defaults to false. */
  cleanTarget?: boolean,
  /** Set the prefix property on the icon entries. Any subdirectories will be appended to this inside the source. Defaults to "the". */
  prefix?: string,
  /** ADVANCED: Group icon variants together. Eg. to recognize user-small and user-large both as user, chop off the last bit. */
  toBaseName?: (relativeName: string) => string,
  /** ADVANCED: Generate fallbacks for missing icons. Eg. to ensure user-small, user-medium, and user-large to exist, return them in an array */
  ensureVariants?: (baseName: string) => Array<string>
};

type FontAwesomeFormat =
  /** Latest supported FontAwesome format */
  'latest' |
  /** Adds an tree-shakeable ESM based format (index.es.js) introduced in FontAwesome 5.1 */
  'v5-esm' |
  /** CommonJS based format in FontAwesome 5.0 */
  'v5-cjs';