Convert SVGs to Font Awesome 5 supported js object format
Last updated 14 days ago by riovir .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install awesomify-svgs 
SYNC missed versions from official npm registry.

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!


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.

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


    -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")
    -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

Can be used to gain better control over the behavior.

async function generate({
  source = 'icons',                           // Relative or absolute path to SVGs to convert
  target = 'dist',                            // Relative or absolute path to target directory
  format = 'latest',                          // Which output Font Awesome format to use
  namespace = 'Awesomify',                    // Prepending the prefix, used as a namespace for UMD bundled index.js files
  deep = true,                                // Whether to deep scan the source directory for icons
  cleanTarget = false,                        // Whether to wipe target first
  prefix = 'the',                             // Set the prefix property on the icon entries any subdirectories will be appended to this inside the source
  toBaseName = relativeName => relativeName,  // Used for grouping icons if sized variants are used. Eg. to recognize user-small and user-large both as user, chop off the last bit
  ensureVariants = _baseName => []             // Used to generate fallbacks for missing icons. Eg. to ensure user-16, user-32, and user-48 to exist, return them in an array
} = {}) {

Current Tags

  • 0.1.5                                ...           latest (14 days ago)

13 Versions

  • 0.1.5                                ...           14 days ago
  • 0.1.4                                ...           a month ago
  • 0.1.3                                ...           3 months ago
  • 0.1.2                                ...           4 months ago
  • 0.1.1                                ...           4 months ago
  • 0.1.0                                ...           4 months ago
  • 0.0.7                                ...           a year ago
  • 0.0.6                                ...           a year ago
  • 0.0.5                                ...           a year ago
  • 0.0.4                                ...           a year ago
  • 0.0.3                                ...           a year ago
  • 0.0.2                                ...           a year ago
  • 0.0.1                                ...           a year ago
Maintainers (1)
Today 0
This Week 0
This Month 34
Last Day 0
Last Week 2
Last Month 19
Dependencies (8)
Dev Dependencies (3)
Dependents (0)

Copyright 2014 - 2016 © |