Git Product home page Git Product logo

Comments (3)

nikoladev avatar nikoladev commented on July 26, 2024 1

This pull request totally works. Thanks!

To anybody trying to figure out how to use it:

gulp.task('subset', function () {
    var gulpFontmin = require('gulp-fontmin');
    var Fontmin = require('fontmin');
    return gulp.src('path/to/font.ttf')
        .pipe(gulpFontmin({
            use: [Fontmin.glyph({
                text: '天地玄黄 宇宙洪荒'
            })]
        }))
        .pipe(gulp.dest('destination/to/subset/fonts/'));
});

from gulp-fontmin.

nikoladev avatar nikoladev commented on July 26, 2024

I had the same problem, except I only wanted ttf files. A quick and dirty fix is to go to node_modules/gulp-fontmin/index.js and change this:

var fontmin = new Fontmin()
    .src(file.contents)
    .use(rename({
        path: file.path
    }))
    .use(Fontmin.glyph(opts))
    .use(Fontmin.ttf2eot())
    .use(Fontmin.ttf2woff())
    .use(Fontmin.ttf2svg())
    .use(Fontmin.css(opts));

to this:

var fontmin = new Fontmin()
    .src(file.contents)
    .use(rename({
        path: file.path
    }))
    // .use(Fontmin.glyph(opts))
    // .use(Fontmin.ttf2eot())
    .use(Fontmin.ttf2woff());
    // .use(Fontmin.ttf2svg())
    // .use(Fontmin.css(opts));

It's on line 92 in version 0.7.3.

Note that this is only a temporary fix, as it will be undone when you upgrade/reinstall your node_modules. A more permanent fix would involve @junmer adding the ability to pass the output types you need as a parameter to gulp-fontmin.

Hope this helps.

from gulp-fontmin.

miklb avatar miklb commented on July 26, 2024

what would be good about this is it would allow passing deflate: true for ttf2woff

from gulp-fontmin.

Related Issues (6)

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.