# gulp-fontmin

> Gulp plugin for minify TTF font to SVG, EOT, WOFF

Latest version **0.7.4** (published 2016-04-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-fontmin
pnpm add gulp-fontmin
yarn add gulp-fontmin
bun add gulp-fontmin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.7.4 |
| Published | 2016-04-06 |
| First published | 2015-03-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 6 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 80 |
| Author | junmer |
| Maintainers | junmer, ecomfe |
| Keywords | gulpplugin, fontmin, font, minify, minifier, compress, ttf, woff, eot, svg |

## Links

- npm: https://www.npmjs.com/package/gulp-fontmin
- Repository: https://github.com/ecomfe/gulp-fontmin
- Homepage: https://github.com/ecomfe/gulp-fontmin#readme
- Issues: https://github.com/ecomfe/gulp-fontmin/issues
- npm.io page: https://npm.io/package/gulp-fontmin

## Dependencies (6)

- [chalk](https://npm.io/package/chalk.md) ^1.0.0
- [fontmin](https://npm.io/package/fontmin.md) ^0.9.3
- [gulp-util](https://npm.io/package/gulp-util.md) ^3.0.0
- [pretty-bytes](https://npm.io/package/pretty-bytes.md) ^3.0.1
- [object-assign](https://npm.io/package/object-assign.md) ^4.0.1
- [through2-concurrent](https://npm.io/package/through2-concurrent.md) ^1.0.0

## Recent versions

- 0.7.4 (latest) — 2016-04-06
- 0.7.3 — 2015-12-23
- 0.7.2 — 2015-07-30
- 0.7.1 — 2015-04-24
- 0.7.0 — 2015-04-20
- 0.6.0 — 2015-04-16
- 0.5.0 — 2015-04-16
- 0.4.0 — 2015-04-16
- 0.3.0 — 2015-03-11

## README

# gulp-fontmin

[![NPM version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]
[![Downloads][downloads-image]][npm-url]
[![Dependencies][dep-image]][dep-url]
[![Font support][font-image]][font-url]

[downloads-image]: http://img.shields.io/npm/dm/gulp-fontmin.svg
[npm-url]: https://npmjs.org/package/gulp-fontmin
[npm-image]: http://img.shields.io/npm/v/gulp-fontmin.svg

[travis-url]: https://travis-ci.org/ecomfe/gulp-fontmin
[travis-image]: http://img.shields.io/travis/ecomfe/gulp-fontmin.svg

[dep-url]: https://david-dm.org/ecomfe/gulp-fontmin
[dep-image]: http://img.shields.io/david/ecomfe/gulp-fontmin.svg

[font-image]:https://img.shields.io/badge/font-senty-blue.svg
[font-url]: http://font.sentywed.com/

> Minify TTF font to SVG, EOT, WOFF with [fontmin](https://github.com/ecomfe/fontmin)

## Install

```
$ npm install --save-dev gulp-fontmin
```

## Usage

```js
var gulp = require('gulp');
var fontmin = require('gulp-fontmin');

gulp.task('default', function () {
    return gulp.src('src/fonts/*.ttf')
        .pipe(fontmin({
            text: '天地玄黄 宇宙洪荒',
        }))
        .pipe(gulp.dest('dist/fonts'));
});
```


## API

### fontmin(options)

Options:

* `text`: A string corresponding glyphs of ttf
* `onlyChinese`: {boolean} keep chinese only, exclude Latin, number and symbol. Default = false
* `fontPath`: {string=} location of font file.
* `hinting`: {boolean=} keep hint info, defaults true.
* `quiet`: {boolean=} print how many fonts were effected, defaults false.


## Practice

### Get needed text from html

```js

function minifyFont(text, cb) {
    gulp
        .src('src/font/*.ttf')
        .pipe(fontmin({
            text: text
        }))
        .pipe(gulp.dest('dest/font'))
        .on('end', cb);
}

gulp.task('fonts', function(cb) {

    var buffers = [];

    gulp
        .src('index.html')
        .on('data', function(file) {
            buffers.push(file.contents);
        })
        .on('end', function() {
            var text = Buffer.concat(buffers).toString('utf-8');
            minifyFont(text, cb);
        });

});
```

## Related

- [gulp-fontmin-demo](https://github.com/junmer/gulp-fontmin-demo)
- [fontmin](https://github.com/ecomfe/fontmin)
- [fontmin-app](https://github.com/ecomfe/fontmin-app)

## License

MIT

---
_Source: https://npm.io/package/gulp-fontmin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
