-
Notifications
You must be signed in to change notification settings - Fork 8
/
gulpfile.js
51 lines (43 loc) · 1.09 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
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', 'copylibs', 'compile']);
paths = {
libs: [
'./src/lib/phaser.min.js'
],
entry: './src/Main.js',
dist: './dist/'
};
gulp.task('compile', function() { // Split watchify into separate step?
var bundler = browserify(paths.entry, watchify.args);
var bundle = function() {
return bundler
.bundle()
.pipe(source('AndrewWorld.min.js'))
.pipe(buffer())
// Uncomment the line below once releasing
// .pipe(uglify())
.pipe(connect.reload())
.pipe(gulp.dest(paths.dist))
}
bundler = watchify(bundler);
bundler.on('update', bundle);
return bundle();
});
gulp.task('copylibs', function() {
gulp.src(paths.libs)
.pipe(gulp.dest(paths.dist + './src/lib'))
});
gulp.task('connect', function() {
connect.server({
root: [__dirname],
port: 9000,
livereload: true
});
});