-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
61 lines (48 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
51
52
53
54
55
56
57
58
59
60
61
'use strict';
var gulp = require('gulp'),
source = require('vinyl-source-stream');
var files = {
html : ['./index.html'],
js : ['./src/game.js', './src/**/*'],
libs : ['./libs/**/*']
};
gulp.task('html', function () {
gulp.src(files.html)
.pipe(gulp.dest('./dist/'));
});
gulp.task('lint', function () {
var jshint = require('gulp-jshint'),
stylish = require('jshint-stylish');
gulp.src(files.js[1])
.pipe(jshint())
.pipe(jshint.reporter(stylish));
});
gulp.task('js', function () {
var browserify = require('browserify'),
es6ify = require('es6ify'),
uglify = require('gulp-uglify'),
buffer = require('vinyl-buffer');
var bundler = browserify({
entries: files.js[0]
});
var bundle = function() {
return bundler
.add(es6ify.runtime)
.transform(es6ify)
.bundle()
.pipe(source(files.js[0]))
.pipe(buffer())
.pipe(uglify())
.pipe(gulp.dest('./dist/'));
};
return bundle();
});
gulp.task('libs', function () {
gulp.src(files.libs)
.pipe(gulp.dest('./dist/libs/'))
});
gulp.task('watch', function () {
gulp.watch(files.js, ['default']);
});
gulp.task('compile', ['html']);
gulp.task('default', ['compile', 'libs', 'js']);