OTS parsing error: incorrect file size in WOFF

soldovskij picture soldovskij · Nov 18, 2015 · Viewed 7.4k times · Source

When you try to download the font woff format, I received an error:

OTS parsing error: incorrect file size in WOFF header

What am I doing wrong ?

Answer

soldovskij picture soldovskij · Nov 18, 2015

This error can occur if you use a gulp or a grunt, forgetting to add fonts formats to src of task.

In my case, it happened when using gulp-rigger, which changes the contents of the file, taking it as text .

Since fonts file is a binary format, then output is broken file.

Fix for me:

gulp.task('start', function () {
    // with filter by file type (.js or .html)
    gulp.src(['./src/**/*.js', './src/**/*.html'])                 
        .pipe(rigger())
        .pipe(gulp.dest('./target'));
});

Instead:

gulp.task('start', function () {
    // all files, iclude fonts .woff
    gulp.src('./src/**/*.*') 
        .pipe(rigger())
        .pipe(gulp.dest('./target'));
});