diff options
-rw-r--r-- | gulpfile.babel.js | 2 | ||||
-rw-r--r-- | src/index.html | 18 |
2 files changed, 18 insertions, 2 deletions
diff --git a/gulpfile.babel.js b/gulpfile.babel.js index b50001b2d..95b026f66 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js | |||
@@ -112,8 +112,6 @@ export function watch() { | |||
112 | export function webserver() { | 112 | export function webserver() { |
113 | gulp.src([ | 113 | gulp.src([ |
114 | paths.dest, | 114 | paths.dest, |
115 | `!${paths.dest}/electron/**`, | ||
116 | `!${paths.dest}/webview/**`, | ||
117 | ]) | 115 | ]) |
118 | .pipe(server({ | 116 | .pipe(server({ |
119 | livereload: true, | 117 | livereload: true, |
diff --git a/src/index.html b/src/index.html index 05a93e37b..9e5acd705 100644 --- a/src/index.html +++ b/src/index.html | |||
@@ -23,6 +23,24 @@ | |||
23 | s.async = true; | 23 | s.async = true; |
24 | s.setAttribute('src', lrHost + '/livereload.js'); | 24 | s.setAttribute('src', lrHost + '/livereload.js'); |
25 | document.body.appendChild(s); | 25 | document.body.appendChild(s); |
26 | |||
27 | s.onload = () => { | ||
28 | console.log('livereload loaded'); | ||
29 | const originalReloadBehaviour = window._onLiveReloadFileChanged; | ||
30 | |||
31 | window._onLiveReloadFileChanged = (file) => { | ||
32 | if (!file.path.includes('/build/webview/') && !file.path.includes('/build/index.js') && !file.path.includes('/build/electron/')) { | ||
33 | originalReloadBehaviour(file); | ||
34 | } else { | ||
35 | if (file.path.includes('/build/webview/')) { | ||
36 | console.log('Livereload: Reloading all webvies'); | ||
37 | const webviews = document.querySelectorAll('webview').forEach(webview => webview.reload()); | ||
38 | } else { | ||
39 | console.log('Livereload: skip reload as only main process files have changed'); | ||
40 | } | ||
41 | } | ||
42 | } | ||
43 | } | ||
26 | })(); | 44 | })(); |
27 | } | 45 | } |
28 | </script> | 46 | </script> |