Gulp v5 corrupt font files
gwicksted opened this issue · comments
What were you expecting to happen?
Gulp copies the binary files verbatim
What actually happened?
Contents of the files were modified with unicode placeholders.
Please give us a sample of your gulpfile
var gulp = require("gulp");
gulp.task("copy-fonts", () => {
return gulp.src("Content/fonts/**/*.*")
.pipe(gulp.dest("bin/Content/fonts"));
});
Terminal output / screenshots
$ npx gulp copy-fonts
Please provide the following information:
- OS & version [e.g. MacOS Catalina 10.15.4]: Windows 10
- node version (run
node -v
): v20.12.1 - npm version (run
npm -v
): 10.5.2 - gulp version (run
gulp -v
): CLI version: 3.0.0
Local version: 5.0.0
Additional information
Switching back to gulp 4.0.2 fixes the issue (files are binary identical).
npm i gulp@4 --save-dev
Switching back to gulp 5.0.0 reproduces the issue.
npm i gulp@5 --save-dev
The source .woff file started with:
00000000: 77 4F 46 46 00 01 00 00
00000008: 00 01 82 F8
0000000C: 00 12 00 00 00 03 4F 38
With gulp v5, the bin copy of the .woff file starts with:
00000000: 77 4F 46 46 00 01 00 00
00000008: 00 01 EF BF BD EF BF BD
00000010: 00 12 00 00 00 03 4F 38
(there are many more instances of that Unicode escape sequence in the woff file)
Troubleshooting
Tried specifying { encoding: "binary" }
in the gulp.src
call but that just changes bytes in different ways. (this variation also works as expected in gulp v4 but not in v5)
Below is the output from gulp v5:
00000000: 77 4F 46 46 00 01 00 00
00000008: 00 01 C2 82 C3 B8 00 12
00000010: 00 00 00 03 4F 38 00 06
Same issue with images and fonts
Had a same issue. Fixed it like this ({encoding: false}
as arg in src
):
import { src, dest } from 'gulp';
const fonts = () => {
return src('source-path', { encoding: false }).pipe(dest('destination-path'))
};
Thank you @KikelDmitry , confirmed working with your fix
Dupe of other open tickets, closing. Docs in the docs folder and release blog post have this but website needs to be updated still.
The website is updated now.