Skip to content

Commit

Permalink
Stop binary files being encoded with UTF-8
Browse files Browse the repository at this point in the history
Gulp v5 changes the way that streams are encoded [1]:

> Our streams now default to UTF-8 encoding. Previously, our streams took whatever data was emitted without considering any encoding. However, in this release, we resolved a 10 year old issue to support custom encodings and we default these to UTF-8. 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.

As the fonts and images are binary we need to set `encoding: false` to avoid them being corrupted.

[1]: https://medium.com/gulpjs/announcing-gulp-v5-c67d077dbdb7#8f65
  • Loading branch information
36degrees committed Jun 3, 2024
1 parent b365bcd commit a15f6a5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/govuk-frontend/tasks/assets.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export const assets = (options) =>
gulp
.src('govuk/assets/**/*', {
base: options.srcPath,
cwd: options.srcPath
cwd: options.srcPath,
encoding: false
})
.pipe(gulp.dest(options.destPath))
)
Expand Down

0 comments on commit a15f6a5

Please sign in to comment.