-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
47 lines (42 loc) · 1.15 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
const gulp = require('gulp');
const babel = require('gulp-babel');
const requirejs = require('gulp-requirejs');
const del = require('del');
const flow = require('gulp-flowtype');
const util = require('gulp-util');
var paths = {
buildTemp: 'build/temp',
es5Game: 'public/media/game',
babel: ['src/*.js', 'src/**/*.js']
};
gulp.task('clean-build-temp', function(){
return del(paths.buildTemp);
});
gulp.task('es6-to-amd', ['clean-build-temp'], function() {
return gulp.src(paths.babel)
/*.pipe(flow({
all: false,
weak: false,
killFlow: false,
abort: true
})).on('error', util.log)*/
.pipe(babel({
presets: ['latest'],
plugins: [
"transform-flow-strip-types",
"transform-es2015-modules-amd"
]
}))
.pipe(gulp.dest(paths.buildTemp));
});
gulp.task('es5-amd-clean', function() {
return del(paths.es5Game);
});
gulp.task('default', ['es5-amd-clean', 'es6-to-amd'], function() {
return requirejs({
name: 'Game',
baseUrl: paths.buildTemp,
out: 'Arkanoid.js'
}).on('error', util.log)
.pipe(gulp.dest(paths.es5Game));
});