forked from github/game-off-2016
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
53 lines (48 loc) · 1.39 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
const del = require('del');
const gulp = require('gulp');
const tsify = require('tsify');
const source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer');
const uglify = require('gulp-uglify');
const browserify = require('browserify');
const webserver = require('gulp-webserver');
const cached = require('gulp-cached');
gulp.task('clean', () => {
return del(['dist']);
});
gulp.task('server', () => {
gulp.src('dist')
.pipe(webserver());
});
gulp.task('scripts', () => {
return browserify({
basedir: '.',
debug: true,
entries: ['src/scripts/main.ts'],
cache: {},
packageCache: {}
})
.plugin(tsify, { noImplicitAny: true, target: 'es5' })
.bundle()
.pipe(source('bundle.js'))
// .pipe(buffer())
// .pipe(uglify()) // TODO: Re-enable this after making source files
.pipe(gulp.dest('dist'));
});
gulp.task('static', () => {
return gulp.src(['src/static/**/*'])
.pipe(gulp.dest('dist'));
});
gulp.task('default',
gulp.series(
gulp.parallel(
'static',
gulp.series('scripts', (done) => {
gulp.watch('src/scripts/**/*', gulp.parallel('scripts'))
gulp.watch('src/static/**/*', gulp.parallel('static'))
done();
})
),
'server'
)
);