0.0.6 • Published 6 years ago

@codpoe/iconfont v0.0.6

Weekly downloads
100
License
MIT
Repository
github
Last release
6 years ago

iconfont

CircleCI David npm (scoped)

An iconfont generator, forked from webfonts-generator

  • 🎉Support svg, ttf, woff, woff2, eot
  • 🥊Develop with TypeScript
  • ✅Pass test
  • 👀Friendly preview

Install

yarn add @codpoe/iconfont

Usage

import iconfont from '@codpoe/iconfont';

(async () => {
  const result = await iconfont({
    fontName: 'helloworld',
    src: 'icons/*.svg',
    out: 'icons-output',
  });
})();

Options

optiontypedefaultdescription
srcstringrequired
outstring / falsefalse
fontNamestring'iconfont'
classPrefixstring'icon-'
hashbooleantrueuse hash
typesarray['svg', 'ttf', 'eot', 'woff', 'woff2']font types
startCodepointnumber0xf101
codepointsobject{}unicode start
normalizebooleantrue
centerHorizontallybooleantrue
cssobjectcss config
htmlobjecthtml config

css / html config

{
  out: true, // string | boolean
  template: TEMPLATES.css / TEMPLATE.html,
  options: {},
}

About out:

  • string: the output path of css / html file.
  • true: the output path is the same as the fonts path.
  • false: no emit css / html file.

By default, css.out is true, html.out is false.

Note

Before generating the iconfont, it's best to convert the svg icons from stroke to fill.

For example, sketch / layer / convert to outlines.