Skip to content

Commit fd30c19

Browse files
authored
Merge pull request #83 from eeditiones/fix/images
fix: prevent gulp v5 from mangling binary files
2 parents ec77c00 + c9bca7c commit fd30c19

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

gulpfile.js

Lines changed: 20 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'
@@ -66,6 +67,17 @@ function watchStatic () {
6667
watch(staticFiles, series(copyStatic));
6768
}
6869

70+
/**
71+
* copy images to 'build'
72+
*/
73+
function copyImages () {
74+
return src(images, {encoding: false}).pipe(dest('build'))
75+
}
76+
77+
function watchImages () {
78+
watch(images, series(copyImages));
79+
}
80+
6981
/**
7082
* Upload all files in the build folder to existdb.
7183
* This function will only upload what was changed
@@ -90,7 +102,7 @@ const xarFilename = `${app.abbrev}-${version}.xar`
90102
* create XAR package in repo root
91103
*/
92104
function createXar () {
93-
return src('build/**/*', {base: 'build/'})
105+
return src('build/**/*', {base: 'build/', encoding: false})
94106
.pipe(zip(xarFilename))
95107
.pipe(dest('dist'))
96108
}
@@ -99,7 +111,7 @@ function createXar () {
99111
* upload and install the latest built XAR
100112
*/
101113
function installXar () {
102-
return src(xarFilename, { cwd:'dist/', encoding: false })
114+
return src(xarFilename, {cwd:'dist/', encoding: false})
103115
.pipe(existClient.install({ packageUri }))
104116
}
105117

@@ -108,11 +120,13 @@ function installXar () {
108120
const build = series(
109121
clean,
110122
templates,
111-
copyStatic
123+
copyStatic,
124+
copyImages
112125
)
113126
const deploy = series(build, deployApp)
114127
const watchAll = parallel(
115128
watchStatic,
129+
watchImages,
116130
watchTemplates,
117131
watchBuild
118132
)
@@ -126,6 +140,8 @@ export {
126140
watchTemplates,
127141
copyStatic,
128142
watchStatic,
143+
copyImages,
144+
watchImages,
129145
build,
130146
deploy,
131147
xar,

0 commit comments

Comments
 (0)