menglingjun 5d386b2c4b add cli
2015-02-12 15:03:00 +08:00
2015-01-30 11:57:45 +08:00
2015-02-05 23:14:43 +08:00
2015-02-05 23:14:43 +08:00
2015-02-06 01:04:57 +08:00
2015-02-06 00:40:26 +08:00
2015-01-30 11:57:45 +08:00
2015-01-30 13:11:51 +08:00
2015-01-30 11:57:45 +08:00
2015-01-30 11:57:45 +08:00
2015-02-12 15:03:00 +08:00
2015-02-06 00:21:16 +08:00
2015-01-30 12:28:54 +08:00
2015-02-06 00:40:53 +08:00
2015-02-06 00:21:16 +08:00
2015-02-12 15:03:00 +08:00

fontmin Build Status

Minify font seamlessly

Install

$ npm install --save fontmin

Usage

var Fontmin = require('fontmin');

var fontmin = new Fontmin()
    .src('fonts/*.ttf')
    .dest('build/fonts')

fontmin.run(function (err, files) {
    if (err) {
        throw err;
    }

    console.log(files[0]);
    // => { contents: <Buffer 00 01 00 ...> }
});

API

new Fontmin()

Creates a new Fontmin instance.

.src(file)

Type: Array|Buffer|String

Set the files to be optimized. Takes a buffer, glob string or an array of glob strings as argument.

.dest(folder)

Type: String

Set the destination folder to where your files will be written. If you don't set any destination no files will be written.

.use(plugin)

Type: Function

Add a plugin to the middleware stack.

.run(cb)

Type: Function

Optimize your files with the given settings.

cb(err, files, stream)

The callback will return an array of vinyl files in files and a Readable/Writable stream in stream

Plugins

The following plugins are bundled with fontmin:

.glyph()

Compress ttf by glyph.

var Fontmin = require('fontmin');

var fontmin = new Fontmin()
    .use(Fontmin.glyph({ 
        text: '天地玄黄 宇宙洪荒'
    }));

.ttf2eot()

Convert ttf to eot.

var Fontmin = require('fontmin');

var fontmin = new Fontmin()
    .use(Fontmin.ttf2eot({ 
        clone: true
    }));

.ttf2woff()

Convert ttf to woff.

var Fontmin = require('fontmin');

var fontmin = new Fontmin()
    .use(Fontmin.ttf2woff({ 
        clone: true
    }));

.ttf2svg()

Convert ttf to svg.

var Fontmin = require('fontmin');

var fontmin = new Fontmin()
    .use(Fontmin.ttf2svg({ 
        clone: true
    }));

Thx

Description
Minify font seamlessly
Readme MIT 29 MiB
Languages
JavaScript 92.9%
TypeScript 3.6%
Smarty 2.1%
HTML 1.4%