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

Possible to limit options for output? #27

Open
rdwatters opened this issue Aug 7, 2016 · 1 comment
Open

Possible to limit options for output? #27

rdwatters opened this issue Aug 7, 2016 · 1 comment
Milestone

Comments

@rdwatters
Copy link

Can't seem to figure this out after tweaking. This obviously isn't an issue, but this is a smaller project without a forum.

I'd like to prevent output from including, svg, eot, and the css files. I'm looking for the more modern stack of just ttf, woff, and woff2.

Even better - the ability to append a string to each filename. I believe this is already part of fontgen, but I'm wondering how to get it done with Gulp.

Cheers.

@olets
Copy link

olets commented Aug 8, 2016

Treating this as a forum question…

At this point woff2 support is weak to the point of being more a future option than a current option - no support for IE, Edge<14, Safari, or iOS Safari.

Here's how to do what you're after without specific support from fontfacegen. Not as elegant maybe but the gulpier, modularized way:

Append strings to the filenames with gulp-rename. e.g. if all the files get the same suffix:

const fontgen = require('gulp-fontgen'),
    rename = require('gulp-rename');

gulp.task('fonts', function() {
    return gulp.src('yoursourcefont')
        .pipe(fontgen(...))
        .pipe(rename({
            basename += "-rdwatters" // adds -rdwatters to the file name
        })
        .pipe(gulp.dest('yourdestinationpath'))
});

or add in gulp-filter to give specific files different suffixes.

Clear out the unneeded files with del (see also the demo recipe) - in its own task, you could do

const del = require('del'),
    fontgen = require('gulp-fontgen');/*, // to support renaming
    rename = require('gulp-rename');*/

gulp.task('fonts:generate', function() {
    return gulp.src('yoursourcefont')
        .pipe(fontgen(...))
        // could add rename stuff here
        // ...
        .pipe(gulp.dest('yourdestinationpath'));
});
gulp.task('fonts', ['fonts:generate'], function() {
    del(['yourdestinationpath/*.{svg,eot,css}'])
});

or you might end up using gulp-filter + gulp-clean

@sgen sgen added this to the 1.0.0 milestone Aug 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants