Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only create woff #6

Open
loominade opened this issue Jun 15, 2016 · 3 comments
Open

only create woff #6

loominade opened this issue Jun 15, 2016 · 3 comments

Comments

@loominade
Copy link

I don't need the css, svg, eot and ttf files. Can I set it up like that?

@nikoladev
Copy link

nikoladev commented Jul 13, 2016

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.

ianbrandt added a commit to ianbrandt/gulp-fontmin that referenced this issue Sep 2, 2016
@nikoladev
Copy link

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/'));
});

@miklb
Copy link

miklb commented Jun 16, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants