@yaming116/iconfont-builder

2.3.2 • Public • Published

iconfont-builder

Build Status npm

中文版

Introduction

Iconfont-builder is a node.js package for providing a middleware that create some font files.

Installation (via npm)

$ npm i --save iconfont-builder

Usage

Simple Usage

var builder = require('iconfont-builder');
var path = require('path');

var options = {
    icons: [
        {
            name: 'www-font-o',
            file: 'abc.svg',
            codepoint: 61441
        }
    ],
    src: path.join(__dirname, 'src'),
    fontName: 'iconfont',
    descent: 0,
    dest: path.join(__dirname, 'dest')
};

builder(options)
    .then().catch();

List of options

icons

Type: Array<Object>

Example:

{
    name: 'www-font-o', // className of icon
    file: 'abc.svg',    // fileName of icon
    codepoint: 61441    // unicode of icon
}

writeFiles

Type: Boolean

Default: true

It is possible to not create font files but get the attribute d of each icon svg. The attribute d contains all paths' information of an icon, which can be use to draw a svg icon.

readFiles

Type: Boolean

Default: true

You can only use attribute d to create font files! If this param is false, the Object in param icons should have attribute d.

fontName

Type: String

Default: 'iconfont'

Name of font and font files.

startCodePoint

Type: Number

Default: 0xF000

Start of font's unicode in DEC(e.g. 61441) or HEX(e.g. 0xF001). When passing options without icons, builder will use startCodePoint as the first unicode of font icon, and the unicode of each remaining icons will increased by one in order.

src

Type: String

Default: '.'

Directory of source svg font files.

dest

Type: String

Directory for generated font files.

descent

Type: Number

Default: 0

The font descent. It's useful to fix the font baseline yourself.

Warning: The descent is a positive value!

Author

missmiss

malcolmyu

Package Sidebar

Install

npm i @yaming116/iconfont-builder

Weekly Downloads

0

Version

2.3.2

License

none

Unpacked Size

20.8 kB

Total Files

12

Last publish

Collaborators

  • yaming116