Giter VIP home page Giter VIP logo

iconfont-builder's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.