forked from owenashurst/agar.io-clone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
50 lines (43 loc) · 1.32 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
var gulp = require('gulp');
var babel = require('gulp-babel');
var jshint = require('gulp-jshint');
var nodemon = require('gulp-nodemon');
gulp.task('build', ['build-client', 'build-server']);
gulp.task('build-client', ['move-client'], function () {
return gulp.src('client/js/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default', { verbose: true}))
.pipe(babel())
.pipe(gulp.dest('bin/client/js/'));
});
gulp.task('move-client', function () {
return gulp.src(['client/**/*.*', '!client/js/*.js'])
.pipe(gulp.dest('./bin/client/'));
});
gulp.task('build-server', ['move-server'], function () {
return gulp.src('server/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default', { verbose: true }))
.pipe(gulp.dest('bin/server/'));
});
gulp.task('move-server', function () {
return gulp.src(['server/**/*.*', '!server/**/*.js'])
.pipe(gulp.dest('./bin/server/'));
});
gulp.task('watch', ["build"], function () {
gulp.watch('client/**/*.*', ['build-client', 'move-client']);
gulp.watch('server/*.*', ['build-server']);
gulp.start("run");
});
gulp.task('run', ["build"], function () {
nodemon({
delay: 10,
script: 'server/server.js',
cwd: "./bin/",
args: ["/server/config.json"],
ext: 'html js css'
})
.on('restart', function () {
console.log('restarted!');
});
});