Skip to content

Iconify Tools ​

Iconify Tools is a set of reusable functions for importing, exporting, and parsing icons.

Library is written in TypeScript.

Installation ​

To install library run:

npm install @iconify/tools --save

CommonJS support ​

The latest version does not support CommonJS.

If you need to use CommonJS, install version 4:

npm install @iconify/tools@cjs --save

Classes ​

In Iconify Tools, all functions for parsing icons work with 2 main classes:

  • SVG represents one icon. This class is used when icon's elements need to be manipulated.
  • IconSet represents an icon set with easy to use functions for managing icons.

Import ​

To start working with an icon set, you can either create blank icon set or import icon set from some source.

Documentation from importing icons:

Before using Iconify Tools, you should be aware that package is opinionated. Certain tags are not allowed and will cause import to fail. See SVG import limitations.

Cleanup and validation ​

Cleaning up and validating icons is the first thing you should do after importing icons if icons come from:

  • Image editing software. Often software leaves a lot of junk code in icons, which must be removed.
  • Third party. You need to make sure icons do not contain scripts, events.

See cleanupSVG() documentation.

Manipulation ​

Iconify Tools offer several functions for manipulating icons. You can:

  • Check or change color palette.
  • Optimise icon.
  • Fix <path> elements to support old software.

See icon manipulation functions for list of available functions.

Export ​

After manipulating icons, you can export icon set to various formats.

Documentation from exporting icons:

Package functions ​

In addition to managing icons, Iconify Tools has several functions to manage packages and repositories: