awesomify-svgs
Convert SVGs to Font Awesome 5 supported js object format
Last updated 2 months 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!

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")
    -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.6                                ...           latest (2 months ago)

14 Versions

  • 0.1.6                                ...           2 months ago
  • 0.1.5                                ...           3 months ago
  • 0.1.4                                ...           4 months ago
  • 0.1.3                                ...           5 months ago
  • 0.1.2                                ...           7 months ago
  • 0.1.1                                ...           7 months ago
  • 0.1.0                                ...           7 months ago
  • 0.0.7                                ...           a year ago
  • 0.0.6                                ...           a year ago
  • 0.0.5                                ...           2 years ago
  • 0.0.4                                ...           2 years ago
  • 0.0.3                                ...           2 years ago
  • 0.0.2                                ...           2 years ago
  • 0.0.1                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 2
This Month 17
Last Day 0
Last Week 14
Last Month 2
Dependencies (7)
Dev Dependencies (4)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |