Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

iconize

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iconize

Converts a bunch of SVG icons to CSS data URLs with PNG fallbacks.

  • 0.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by400%
Maintainers
1
Weekly downloads
 
Created
Source

iconize

Converts a bunch of SVG icons to CSS data URLs with PNG fallbacks. Inspired by grunticon, but simpler and not requiring grunt.

Usage

iconize(files, options, done)

Takes an array of file paths and an options object. Available options are:

  • defaultWidth: default icon width in pixels, when unspecified by the SVG file. The default is 32.

  • defaultHeight: default icon height in pixels, when unspecified by the SVG file. The default is 32.

  • cssPath: path to generated CSS file. The default is icons.css.

  • pngDir: path to the directory where PNG files are placed, which will be created if nonexistent. The default is png.

  • cssUrlPrefix: path to PNG files used by CSS URLs. By default, the value of pngDir is used.

  • cssSelector: a function taking an SVG path and a variant (see below) as arguments, and returning the CSS selector for the variant. The default is .icon-#{base}#{selector}, where

    • base is the basename of the SVG path, converted to lowercase, and with all characters other than letters, digits, hyphen and underscore removed.

    • selector is variant.selector.

  • variantsOnly: if true, only build the specified variants (see below). By default, the unmodified icon is also built.

  • variants: a (possibly empty) array of objects with keys:

    • name: variant name to be appended to PNG file names.
    • selector: string to be appended to the CSS selector for this variant.
    • transform: a function taking an SVG string and returning another SVG string.

Variants allow the creation of alternative versions of the icons by transforming the SVG (e.g., change the color on hover).

Keywords

FAQs

Package last updated on 19 Mar 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc