From 685749e917f005bd95552eb25a31fa43a896c65b Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Sat, 14 Sep 2024 11:41:57 -0400 Subject: [PATCH] Fix copying of binary files during asset build This fixes another instance of the issue identified in https://github.com/hypothesis/client/pull/6527. Fixes https://github.com/hypothesis/h/issues/8952 --- gulpfile.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 912dd5b7a0b..108e76d9bcd 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -45,7 +45,10 @@ const fontFiles = 'h/static/styles/vendor/fonts/h.woff'; gulp.task('build-fonts', () => { const fontsDir = 'build/fonts'; - return gulp.src(fontFiles).pipe(changed(fontsDir)).pipe(gulp.dest(fontsDir)); + return gulp + .src(fontFiles, { encoding: false }) + .pipe(changed(fontsDir)) + .pipe(gulp.dest(fontsDir)); }); gulp.task('watch-fonts', () => { @@ -75,7 +78,11 @@ gulp.task('build-images', () => { const imagesDir = 'build/images'; return gulp - .src(imageFiles) + .src(imageFiles, { + // Treat all files as binary. Some of the images are SVGs which are text, + // but `svgmin` is still able to process the files if passed as binary. + encoding: false, + }) .pipe(changed(imagesDir)) .pipe(gulpIf(shouldMinifySVG, svgmin(svgminConfig))) .pipe(gulp.dest(imagesDir));