Skip to content

Javascript library to generate an icon library from SVGs

License

Notifications You must be signed in to change notification settings

roumilb/svg-to-iconfont

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SVG to icon font

Install

npm install @roumi/svg-to-icon-font

Generate a new font

The library will generate CSS, Woff, Woff2 files.

To use your new font, you can use the class [fontName]-[icon-name] to display an icon.

You can check the icon-list.html in the output folder to see a list of all of the icons.

Using the CLI

If you want to use the cli command you can either install it globaly this way:

npm install -g @roumi/svg-to-icon-font
generate-icon-font icon "/path/to/icons.zip" "/path/to/output"

Or you can use npx if you install it locally:

npx generate-icon-font icon "/path/to/icons.zip" "/path/to/output"

Using the code API

Use the function generateIconFont(fontName, zipFilePath) to generate a new font from a zip file containing all the icons in SVG format.

import {generateIconFont} from '@roumi/svg-to-icon-font';

await generateIconFont('icon', '/path/to/icons.zip', '/path/to/output');

// CSS, Woff, Woff2 files are in the output folder
// You also have the icon-list.html file to see all the icons

Font name examples

  • icon => <i class="icon-trash"></i>
  • my-projet => <i class="my-projet-trash"></i>
  • "this is a test" => <i class="thisisatest-trash"></i>

License

This library is released under the MIT license. You are free to use, modify, and distribute it as you see fit. See the LICENSE file for more information.

About

Javascript library to generate an icon library from SVGs

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published