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:
Import
To start working with 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 fail import. 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 leave 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: