-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Simple gulp copy garbles font files #2790
Comments
I just checked, I have a very similar method copyImages, which also a simple copy and it corrupts all image files in the process. So the problem is not just with fonts, but all binary files. |
you have to specify {encoding: false} as an option to src for binary files. |
Thanks, I hoped something like exists, but the docs not mentioning it. |
same issue for me. this worked with a gulp <5 |
https://medium.com/gulpjs/announcing-gulp-v5-c67d077dbdb7 Most usage of gulp won’t need to change anything, but certain plugins may produce non-UTF-8 output and you’ll need to set |
it also corrupts images |
Closing this since the solution has already been posted - but in v5 you need to specify encoding: false for binary data (was in the blog post, and is in the changelog, and the API docs). |
@yocontra I don't think this should be closed:
I feel this major a breaking change shouldn't be discoverable only deep within an announcement blog post not even in this repository nor the Even better would be Gulp detecting binary files loaded via Update: This repository's own README file's Incremental Builds example doesn't even specify the Update 2: A quick Github search shows many, many Gulpfiles in use loading binary files as-is for simple copying – including some big projects like Mozilla's pdf.js (46k stars), Cypress (46k stars), Layui (28k stars) – so this change will impact many people when they update. |
@adamaveray Closing specific issues because there has been so many duplicates, but totally understand the overall problem with regards to docs and communication of this change and its something we're working on (#2764). The docs in the repo have been updated but the website has not been updated in a long time (almost 2yrs), there were issues getting a new deploy out and it's being worked on right now to get it updated soon. As an aside from documentation: Also - those projects you linked that use v4 can stick with v4 until v5 has stabilized some more, there is nothing fundamental that would force anyone to upgrade right now if you have a setup that is already working for you. We've been very careful with the ecosystem to make sure v3, v4, v5 are not mandatory upgrades. You can see how many people are still installing an 8yr old v3 per week. |
This comment has been minimized.
This comment has been minimized.
Gulp v5 streams now default to UTF-8 encoding. Most usage of gulp won’t need to change anything, but certain plugins may produce non-UTF-8 output and you’ll need to set `{ encoding: false }` on your gulp streams. It appears images and fonts (gulpjs/gulp#2790) get affected hence our test was failing https://concourse.notify.tools/builds/114181855#L666d232d:1367
@yocontra I faced the same issue and However, how do I deal with mixed file types in src(['assets/*.woff', 'assets/*.css', 'assets/*.png']) Should I add |
Gulp v5 streams now default to UTF-8 encoding. "Most usage of gulp won’t need to change anything, but certain plugins may produce non-UTF-8 output and you’ll need to set `{ encoding: false }` on your gulp streams." It appears images and fonts (gulpjs/gulp#2790) get affected hence our test was failing https://concourse.notify.tools/builds/114181855#L666d232d:1367
Gulp v5 streams now default to UTF-8 encoding. "Most usage of gulp won’t need to change anything, but certain plugins may produce non-UTF-8 output and you’ll need to set `{ encoding: false }` on your gulp streams." It appears images and fonts (gulpjs/gulp#2790) get affected hence our test was failing https://concourse.notify.tools/builds/114181855#L666d232d:1367
Gulp v5 streams now default to UTF-8 encoding. "Most usage of gulp won’t need to change anything, but certain plugins may produce non-UTF-8 output and you’ll need to set `{ encoding: false }` on your gulp streams." It appears images and fonts (gulpjs/gulp#2790) get affected hence our test was failing https://concourse.notify.tools/builds/114181855#L666d232d:1367
Before you open this issue, please complete the following tasks:
What were you expecting to happen?
I am expecting to see the font files copied over to have the same size (and work when consumed - it does not!)
What actually happened?
Simple copy job somehow garbles the files and they become corrupt.
Source files:
209128 Apr 2 14:32 fa-brands-400.ttf
117852 Apr 2 14:32 fa-brands-400.woff2
67860 Apr 2 14:32 fa-regular-400.ttf
25392 Apr 2 14:32 fa-regular-400.woff2
420332 Apr 2 14:32 fa-solid-900.ttf
156400 Apr 2 14:32 fa-solid-900.woff2
Copied files at target directory:
228639 Apr 2 14:32 fa-brands-400.ttf
214303 Apr 2 14:32 fa-brands-400.woff2
76830 Apr 2 14:32 fa-regular-400.ttf
46429 Apr 2 14:32 fa-regular-400.woff2
471443 Apr 2 14:32 fa-solid-900.ttf
284306 Apr 2 14:32 fa-solid-900.woff2
Please give us a sample of your gulpfile
Terminal output / screenshots
Job runs seemingly without any errors
Please provide the following information:
node -v
): 20.11.0npm -v
): 10.2.4gulp -v
): CLI version 3.0.0, local version: 5.0.0Additional information
The text was updated successfully, but these errors were encountered: