iconr

CLI tool that takes a directory of SVG images and outputs a CSS file and a directory of PNG images as a fallback.

npm install iconr
1 downloads in the last day
49 downloads in the last week
65 downloads in the last month

iconr NPM version NPM version

Description

Parses a directory of SVG images and outputs a CSS file of inlined data URIs as well as a directory of PNG images for fallback.

Iconr Screenshot

Usage

Usage:

  iconr [inputDirectory] [outputDirectory] -options

Description:

  Parses a directory of SVG images and outputs a CSS file of inlined data URIs as well as a directory of PNG images for fallback.

Options:

  -h, --help           Output usage information
  -V, --version        Output version number
  -a, --analytics      Displays a summary of application process tasks
  -v, --verbose        Verbose mode: log application progress to the console
  -d, --debug          Debug mode: will output additional information for development
  -p, --pretty         Output CSS in a "beautified" format
  -b, --b64            Base64 encode SVG data URI (fallback PNG is always Base64)
  -n, --nopng          Suppress creation of PNG fallback images (needed for < IE7)
  -o, --optimizesvg    Will attempt to optimize the SVG to minimize file size
  -c, --classname      Set a prefix for css classes (default classname is SVG filename)
  -f, --filename       Set filename of css output (default is iconr.css)
  -s, --stdout         Use this to output to stdout instead of saving to a file
  -k, --killcomment    Removes the "generated by iconr" CSS comment

Examples:

  $ iconr ./svgIcons ./svgCss -vao
  $ iconr ./images/svg-icons ./css -pn --filename="svg-icons.css"

Dependencies

Expects Modernizr classes on front-end.

Contributing to Iconr

Contributions and pull requests are very welcome. Please follow these guidelines when submitting new code.

  1. Make all changes in Coffeescript files, not JavaScript files.
  2. For feature changes, update both jQuery and Prototype versions
  3. Use npm install -d to install the correct development dependencies.
  4. Use cake build or cake watch to generate Iconr's JavaScript file and minified version.
  5. Don't touch the VERSION file
  6. Submit a Pull Request using GitHub.

Using CoffeeScript & Cake

First, make sure you have the proper CoffeeScript / Cake set-up in place. We have added a package.json that makes this easy:

npm install -d

This will install coffee-script and uglifyjs.

Once you're configured, building the JavasScript from the command line is easy:

cake build                # build Iconr from source
cake watch                # watch coffee/ for changes and build Iconr

If you're interested, you can find the recipes in Cakefile.

License

Released under the MIT License.

NPM

npm loves you