aboutsummaryrefslogtreecommitdiffstats
path: root/gulpfile.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-03-30 12:53:38 +0800
committerkumavis <aaron@kumavis.me>2018-03-30 12:53:38 +0800
commitb2d0e9871c5004458ef9be4a83d08df8a39e6e48 (patch)
tree4dd1525135037e4a464691a8f138f1196cc0e0e2 /gulpfile.js
parent4606a23c3fbfbbbd93ea59f3ca3e2e06766d3a04 (diff)
downloadtangerine-wallet-browser-b2d0e9871c5004458ef9be4a83d08df8a39e6e48.tar
tangerine-wallet-browser-b2d0e9871c5004458ef9be4a83d08df8a39e6e48.tar.gz
tangerine-wallet-browser-b2d0e9871c5004458ef9be4a83d08df8a39e6e48.tar.bz2
tangerine-wallet-browser-b2d0e9871c5004458ef9be4a83d08df8a39e6e48.tar.lz
tangerine-wallet-browser-b2d0e9871c5004458ef9be4a83d08df8a39e6e48.tar.xz
tangerine-wallet-browser-b2d0e9871c5004458ef9be4a83d08df8a39e6e48.tar.zst
tangerine-wallet-browser-b2d0e9871c5004458ef9be4a83d08df8a39e6e48.zip
build - fix copy devMode
Diffstat (limited to 'gulpfile.js')
-rw-r--r--gulpfile.js63
1 files changed, 31 insertions, 32 deletions
diff --git a/gulpfile.js b/gulpfile.js
index 4a4ab8ee0..c2e18395c 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -114,6 +114,37 @@ function createCopyTasks(label, opts) {
copyDevTaskNames.push(copyDevTaskName)
}
+function copyTask(taskName, opts){
+ const source = opts.source
+ const destination = opts.destination
+ const destinations = opts.destinations || [destination]
+ const pattern = opts.pattern || '/**/*'
+ const devMode = opts.devMode
+
+ return gulp.task(taskName, function () {
+ if (devMode) {
+ watch(source + pattern, (event) => {
+ livereload.changed(event.path)
+ performCopy()
+ })
+ }
+
+ return performCopy()
+ })
+
+ function performCopy() {
+ // stream from source
+ let stream = gulp.src(source + pattern, { base: source })
+
+ // copy to destinations
+ destinations.forEach(function(destination) {
+ stream = stream.pipe(gulp.dest(destination))
+ })
+
+ return stream
+ }
+}
+
// manifest tinkering
gulp.task('manifest:chrome', function() {
@@ -402,38 +433,6 @@ gulp.task('dist',
// task generators
-function copyTask(taskName, opts){
- const source = opts.source
- const destination = opts.destination
- const destinations = opts.destinations || [ destination ]
- const pattern = opts.pattern || '/**/*'
- const devMode = opts.devMode
-
- return gulp.task(taskName, performCopy)
-
- function performCopy(){
- // stream from source
- let stream
- if (devMode) {
- stream = watch(source + pattern, { base: source })
- } else {
- stream = gulp.src(source + pattern, { base: source })
- }
-
- // copy to destinations
- destinations.forEach(function(destination) {
- stream = stream.pipe(gulp.dest(destination))
- })
-
- // trigger reload
- if (devMode) {
- stream.pipe(livereload())
- }
-
- return stream
- }
-}
-
function zipTask(target) {
return () => {
return gulp.src(`dist/${target}/**`)