-
Notifications
You must be signed in to change notification settings - Fork 49
/
gulpfile.js
42 lines (35 loc) · 895 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
42
var gulp = require('gulp'),
uglify = require('gulp-uglify'),
browserify = require('browserify'),
watchify = require('watchify'),
buffer = require('vinyl-buffer'),
connect = require('gulp-connect'),
source = require('vinyl-source-stream'),
jshint = require('gulp-jshint');
gulp.task('default', ['connect', 'compile']);
paths = {
entry: './client/src/main.js',
dist: './client/dist/'
};
gulp.task('compile', function() {
var bundler = browserify(paths.entry, watchify.args);
var bundle = function() {
return bundler
.bundle()
.pipe(source('bomb_arena.min.js'))
.pipe(buffer())
.pipe(uglify())
.pipe(connect.reload())
.pipe(gulp.dest(paths.dist))
}
bundler = watchify(bundler);
bundler.on('update', bundle);
return bundle();
});
gulp.task('connect', function() {
connect.server({
root: [__dirname + '/client'],
port: 9000,
livereload: true
});
});