-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgulpfile.js
More file actions
33 lines (29 loc) · 1.04 KB
/
gulpfile.js
File metadata and controls
33 lines (29 loc) · 1.04 KB
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
var gulp = require('gulp');
var plumber = require('gulp-plumber');
var $ = require('gulp-load-plugins')();
var electron = require('electron-connect').server.create();
var srcDir = 'src';
var distDir = 'build';
gulp.task('compile', function(){
return gulp.src(srcDir + '/**/*.{js,jsx}')
.pipe(plumber())
.pipe($.babel())
.pipe(gulp.dest(distDir));
});
// Make HTML and concats CSS files.
gulp.task('html', function () {
return gulp.src(srcDir + '/renderer/**/*.html')
.pipe(gulp.dest(distDir + '/renderer'))
;
});
// コンパイルしてElectron起動
gulp.task('start', ['compile', 'html'], function(){
// electron開始
electron.start();
// ファイルが変更されたら再コンパイル
gulp.watch(srcDir + '/**/*.{js,jsx}', ['compile']);
// BrowserProcessが読み込むファイルが変更されたらRestart。
gulp.watch(['main.js'], electron.restart);
// RendererProcessが読み込むファイルが変更されたらReload。
gulp.watch(['index.html', distDir + '/**/*.{html,js,css}'], electron.reload);
});