diff options
author | kumavis <aaron@kumavis.me> | 2018-03-30 12:53:38 +0800 |
---|---|---|
committer | kumavis <aaron@kumavis.me> | 2018-03-30 12:53:38 +0800 |
commit | b2d0e9871c5004458ef9be4a83d08df8a39e6e48 (patch) | |
tree | 4dd1525135037e4a464691a8f138f1196cc0e0e2 /gulpfile.js | |
parent | 4606a23c3fbfbbbd93ea59f3ca3e2e06766d3a04 (diff) | |
download | tangerine-wallet-browser-b2d0e9871c5004458ef9be4a83d08df8a39e6e48.tar.gz tangerine-wallet-browser-b2d0e9871c5004458ef9be4a83d08df8a39e6e48.tar.zst tangerine-wallet-browser-b2d0e9871c5004458ef9be4a83d08df8a39e6e48.zip |
build - fix copy devMode
Diffstat (limited to 'gulpfile.js')
-rw-r--r-- | gulpfile.js | 63 |
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}/**`) |