Skip to content

Commit 1bda3bc

Browse files
committed
fix: prevent gulp v5 from mangling binary files
1 parent 419ce77 commit 1bda3bc

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

gulpfile.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ function watchTemplates () {
5353
}
5454

5555

56-
const staticFiles = 'src/**/*.{xml,html,xq,xqm,xsl,xconf,json,svg,js,css,png,jpg,map}'
56+
const staticFiles = 'src/**/*.{xml,html,xq,xqm,xsl,xconf,json,svg,js,css,map}'
57+
const images = 'src/**/*.{png,jpg}'
5758

5859
/**
5960
* copy html templates, XSL stylesheet, XMLs and XQueries to 'build'
@@ -62,9 +63,19 @@ function copyStatic () {
6263
return src(staticFiles).pipe(dest('build'))
6364
}
6465

66+
/**
67+
* copy html templates, XSL stylesheet, XMLs and XQueries to 'build'
68+
*/
69+
function copyImages () {
70+
return src(images, {encoding: false}).pipe(dest('build'))
71+
}
72+
6573
function watchStatic () {
6674
watch(staticFiles, series(copyStatic));
6775
}
76+
function watchImages () {
77+
watch(images, series(copyImages));
78+
}
6879

6980
/**
7081
* Upload all files in the build folder to existdb.
@@ -90,7 +101,7 @@ const xarFilename = `${app.abbrev}-${version}.xar`
90101
* create XAR package in repo root
91102
*/
92103
function createXar () {
93-
return src('build/**/*', {base: 'build/'})
104+
return src('build/**/*', {base: 'build/', encoding: false})
94105
.pipe(zip(xarFilename))
95106
.pipe(dest('dist'))
96107
}
@@ -99,7 +110,7 @@ function createXar () {
99110
* upload and install the latest built XAR
100111
*/
101112
function installXar () {
102-
return src(xarFilename, { cwd:'dist/', encoding: false })
113+
return src(xarFilename, {cwd:'dist/', encoding: false})
103114
.pipe(existClient.install({ packageUri }))
104115
}
105116

@@ -108,11 +119,13 @@ function installXar () {
108119
const build = series(
109120
clean,
110121
templates,
111-
copyStatic
122+
copyStatic,
123+
copyImages
112124
)
113125
const deploy = series(build, deployApp)
114126
const watchAll = parallel(
115127
watchStatic,
128+
watchImages,
116129
watchTemplates,
117130
watchBuild
118131
)
@@ -126,6 +139,8 @@ export {
126139
watchTemplates,
127140
copyStatic,
128141
watchStatic,
142+
copyImages,
143+
watchImages,
129144
build,
130145
deploy,
131146
xar,

0 commit comments

Comments
 (0)