-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
62 lines (52 loc) · 1.47 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
55
56
57
58
59
60
61
62
var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
gulp.task('copy', [
'copy:html',
'copy:assets'
]);
gulp.task('copy:html', function () {
return gulp.src('./src/index.html')
.pipe(gulp.dest('./dist/'));
});
gulp.task('copy:assets', [
'copy:assetsDir',
'copy:audio',
'copy:data',
'copy:images'
]);
gulp.task('copy:assetsDir', function () {
return gulp.src('./src/assets/*')
.pipe(gulp.dest('./dist/assets/'));
});
gulp.task('copy:audio', function () {
return gulp.src('./src/audio/*')
.pipe(gulp.dest('./dist/audio/'));
});
gulp.task('copy:data', function () {
return gulp.src('./src/data/*')
.pipe(gulp.dest('./dist/data/'));
});
gulp.task('copy:images', function () {
return gulp.src('./src/images/*')
.pipe(gulp.dest('./dist/images/'));
});
gulp.task('browserify', function() {
return browserify('./src/js/platformer.js')
.bundle()
.on('error', function (err) {
console.error(err);
this.emit('end');
})
.pipe(source('bundle.js'))
.pipe(gulp.dest('./dist/js/'));
});
gulp.task('watch', function () {
gulp.watch(['src/index.html'], ['copy:html']);
gulp.watch(['src/assets/**/*'], ['copy:assetsDir']);
gulp.watch(['src/audio/*'], ['copy:audio']);
gulp.watch(['src/data/*'], ['copy:data']);
gulp.watch(['src/images/*'], ['copy:images']);
gulp.watch(['src/js/**/*.js'], ['browserify']);
});
gulp.task('default', ['copy', 'browserify', 'watch']);