aboutsummaryrefslogtreecommitdiffstats
path: root/gulpfile.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-03-30 13:19:15 +0800
committerkumavis <aaron@kumavis.me>2018-03-30 13:19:15 +0800
commit7b9b890aa94557c4665be00da8c0f2e24ba4ea1a (patch)
treeb37d154d9871e584e427ffc87d57b2ef153fcfc2 /gulpfile.js
parentb2d0e9871c5004458ef9be4a83d08df8a39e6e48 (diff)
downloadtangerine-wallet-browser-7b9b890aa94557c4665be00da8c0f2e24ba4ea1a.tar
tangerine-wallet-browser-7b9b890aa94557c4665be00da8c0f2e24ba4ea1a.tar.gz
tangerine-wallet-browser-7b9b890aa94557c4665be00da8c0f2e24ba4ea1a.tar.bz2
tangerine-wallet-browser-7b9b890aa94557c4665be00da8c0f2e24ba4ea1a.tar.lz
tangerine-wallet-browser-7b9b890aa94557c4665be00da8c0f2e24ba4ea1a.tar.xz
tangerine-wallet-browser-7b9b890aa94557c4665be00da8c0f2e24ba4ea1a.tar.zst
tangerine-wallet-browser-7b9b890aa94557c4665be00da8c0f2e24ba4ea1a.zip
build - fix scss + js reload
Diffstat (limited to 'gulpfile.js')
-rw-r--r--gulpfile.js20
1 files changed, 12 insertions, 8 deletions
diff --git a/gulpfile.js b/gulpfile.js
index c2e18395c..5e7b5dc03 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -28,7 +28,8 @@ const stylefmt = require('gulp-stylefmt')
const uglify = require('gulp-uglify-es').default
const babel = require('gulp-babel')
const debug = require('gulp-debug')
-
+const pify = require('pify')
+const endOfStream = pify(require('end-of-stream'))
const disableDebugTools = gutil.env.disableDebugTools
const debugMode = gutil.env.debug
@@ -260,7 +261,11 @@ gulp.task('dev:scss', createScssBuildTask({
function createScssBuildTask({ src, dest, devMode, pattern }) {
return function () {
if (devMode) {
- watch(pattern, buildScss)
+ watch(pattern, async (event) => {
+ const stream = buildScss()
+ await endOfStream(stream)
+ livereload.changed(event.path)
+ })
}
return buildScss()
}
@@ -454,7 +459,11 @@ function generateBundler(opts, performBundle) {
if (opts.watch) {
bundler = watchify(bundler)
// on any file update, re-runs the bundler
- bundler.on('update', performBundle)
+ bundler.on('update', async (ids) => {
+ const stream = performBundle()
+ await endOfStream(stream)
+ livereload.changed(`${ids}`)
+ })
}
return bundler
@@ -494,7 +503,6 @@ function bundleTask(opts) {
return performBundle
function performBundle(){
-
let buildStream = bundler.bundle()
// handle errors
@@ -545,10 +553,6 @@ function bundleTask(opts) {
buildStream = buildStream.pipe(gulp.dest(dest))
})
- // finally, trigger live reload
- buildStream = buildStream
- .pipe(gulpif(debugMode, livereload()))
-
return buildStream
}