forked from paulsutherland/Polyonic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
41 lines (37 loc) · 1016 Bytes
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const gulp = require('gulp')
const electron = require('electron-connect').server.create()
const env = require('gulp-env')
const config = require('@ionic/app-scripts/dist/util/config')
const ionic = require('@ionic/app-scripts')
gulp.task('dev', function () {
env.set({
NODE_ENV: 'development'
})
ionic.watch(config.generateContext())
.then(function () {
electron.start(() => {
gulp.watch('src/main.js', restart)
gulp.watch([
'www/js/app.js',
'www/**/*.html',
'www/**/*.css',
'www/**/*.js'], reload)
})
})
.catch(function (err) {
console.log('Error starting watch: ', err)
})
})
function restart (done) {
electron.restart('--enable-logging', function (state) {
if (state === 'restarted' || state === 'restarting') {
done(null)
} else {
done('Unexpected state while restarting electron-connect server. State ' + state)
}
})
}
function reload (done) {
electron.reload()
done(null)
}