forked from ricardomansano/reactron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
54 lines (44 loc) · 1.39 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
53
54
const exec = require('child_process').exec;
const gulp = require('gulp');
const babel = require('gulp-babel');
const css = require('gulp-clean-css');
const livereload = require('gulp-livereload');
gulp.task('copy', () => {
return gulp.src('assets/**/*')
.pipe(gulp.dest('app/assets'));
});
gulp.task('html', () => {
return gulp.src('src/index.html')
.pipe(gulp.dest('app/'))
.pipe(livereload());
});
gulp.task('css', () => {
return gulp.src('src/**/*.css')
.pipe(css())
.pipe(gulp.dest('app/'))
.pipe(livereload());
});
gulp.task('js', () => {
return gulp.src(['main.js', 'src/**/*.js'])
.pipe(babel())
.pipe(gulp.dest('app/'))
.pipe(livereload());
});
gulp.task('watch', async function () {
livereload.listen();
gulp.watch('src/**/*.html', gulp.series('html'));
gulp.watch('src/**/*.css', gulp.series('css'));
gulp.watch('src/**/*.js', gulp.series('js'));
});
gulp.task('build', gulp.series('copy', 'html', 'css', 'js'));
gulp.task('start', gulp.series('build', () => {
return exec(
__dirname + '/node_modules/.bin/electron .'
).on('close', () => process.exit());
}));
gulp.task('default', gulp.parallel('start', 'watch'));
gulp.task('dist', gulp.series('build', () => {
return exec(
__dirname + '/node_modules/.bin/electron-builder .'
).on('close', () => process.exit());
}));