Iconify Tools
Iconify Tools is a set of reusable functions for importing, exporting, and parsing icons.
Library is written in TypeScript, is available as ES modules for modern development and CommonJS for older scripts.
Installation
To install library run:
npm install @iconify/tools --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:
- Importing Iconify JSON data.
- Importing SVG.
- Importing all SVG in directory.
- Importing icons from Figma.
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:
- Exporting Iconify JSON data.
- Exporting SVG to directory (simplified version).
- Exporting SVG.
- Exporting icon packages.
- Exporting Iconify JSON packages.
Package functions
In addition to managing icons, Iconify Tools has several functions to manage packages and repositories: