1.1.0 • Published 6 months ago

svg2fontello v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
6 months ago

svg2fontello

presentation

This package convert svg files in fontello files for web

Installation

npm i svg2fontello

yarn add svg2fontello

Create a file .svg2fontellorc at the root of your project with this content :

{
  "svg": "./src/assets/svg",
  "outputFonts": "./src/assets/fonts",
  "importFontsPath": "../assets/fonts/",
  "outputTypes": "./src/types/IconTypes.js",
  "outputStyles": "./src/styles/fontello.css"
}
Propertydescription
svgthe path to your svgs files
outputFontsthe path where the font files are copied (eot, svg, ttf, woff, woff2)
importFontsPaththe relative path to your fonts from the css file
outputTypesThe constant definition file in javascript
outputStylesThe css file output

Add Script

In your package.json add this command inside the "scripts" element :

    "scripts": {
        ...other scripts
        "fontello":"svg2fontello"
    }

Use the command line npm run fontello in your terminal to generate all files

Usage

  • Import the css file in your web page
  • use html element <i class="fontello-[iconName]" /> (replace iconName by the name of your icon)

The icon name is the svg file name converted in kebab-case.

Example :

For "Toggle off.svg" file use <i class="fontello-toggle-off" />

Example in ReactJS :

<i className={IconTypes.TOGGLE_OFF} />

1.1.0

6 months ago

1.0.31

6 months ago

1.0.30

6 months ago

1.0.28

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago