forked from PrismarineJS/flying-squid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
48 lines (42 loc) · 1.08 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
var gulp = require('gulp');
var plumber = require('gulp-plumber');
var babel = require('gulp-babel');
var options = {
presets: ['babel-preset-stage-0','es2015'],
plugins:['transform-runtime']
};
var sourcemaps = require('gulp-sourcemaps');
gulp.task('compile', function() {
return gulp
.src('src/**/*.js')
.pipe(plumber({
errorHandler: function(err) {
console.error(err.stack);
this.emit('end');
}
}))
.pipe(sourcemaps.init())
.pipe(babel(options))
.pipe(plumber.stop())
.pipe(sourcemaps.write('maps/'))
.pipe(gulp.dest('dist/'));
});
gulp.task('compileTest', function() {
return gulp
.src('test/**/*.js')
.pipe(plumber({
errorHandler: function(err) {
console.error(err.stack);
this.emit('end');
}
}))
.pipe(sourcemaps.init())
.pipe(babel(options))
.pipe(plumber.stop())
.pipe(sourcemaps.write('maps/'))
.pipe(gulp.dest('distTest/'));
});
gulp.task('watch', function() {
return gulp.watch('src/**/*.js', ['compile']);
});
gulp.task('default', ['compile','compileTest']);