2015-02-22 11:27:46 -05:00
|
|
|
var gulp = require('gulp');
|
|
|
|
|
2015-05-21 16:22:20 -04:00
|
|
|
var plumber = require('gulp-plumber');
|
2015-05-14 16:08:49 -04:00
|
|
|
var babel = require('gulp-babel');
|
2015-02-22 11:27:46 -05:00
|
|
|
var options = {
|
2015-11-16 10:37:28 -05:00
|
|
|
presets: ['es2015']
|
2015-02-22 11:27:46 -05:00
|
|
|
};
|
|
|
|
|
2015-02-22 11:49:29 -05:00
|
|
|
var sourcemaps = require('gulp-sourcemaps');
|
|
|
|
|
2015-02-22 11:27:46 -05:00
|
|
|
gulp.task('compile', function() {
|
2015-08-06 14:09:36 -04:00
|
|
|
return gulp
|
2015-05-14 16:08:49 -04:00
|
|
|
.src('src/**/*.js')
|
2015-05-21 16:22:20 -04:00
|
|
|
.pipe(plumber({
|
|
|
|
errorHandler: function(err) {
|
|
|
|
console.error(err.stack);
|
|
|
|
this.emit('end');
|
|
|
|
}
|
|
|
|
}))
|
2015-05-14 16:08:49 -04:00
|
|
|
.pipe(sourcemaps.init())
|
|
|
|
.pipe(babel(options))
|
2015-05-21 16:22:20 -04:00
|
|
|
.pipe(plumber.stop())
|
2015-05-14 16:08:49 -04:00
|
|
|
.pipe(sourcemaps.write('maps/'))
|
|
|
|
.pipe(gulp.dest('dist/'));
|
2015-02-22 11:27:46 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
gulp.task('watch', function() {
|
2015-08-06 14:09:36 -04:00
|
|
|
return gulp.watch('src/**/*.js', ['compile']);
|
2015-02-22 11:27:46 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
gulp.task('default', ['compile']);
|