-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
36 lines (32 loc) · 882 Bytes
/
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
var gulp = require('gulp');
var eslint = require('gulp-eslint');
var cache = require('gulp-cached');
var babel = require('gulp-babel');
var plumber = require('gulp-plumber');
var watch = require('gulp-watch');
var batch = require('gulp-batch');
var optimizeJS = require('gulp-optimize-js');
var src = './src/**/*.js';
gulp.task('compile', function () {
return gulp.src(src)
.pipe(cache('eslint', { optimizeMemory: true }))
.pipe(eslint({
configFile: '.eslintrc.js',
quiet: true
}))
.pipe(eslint.format())
.pipe(eslint.failAfterError())
.pipe(plumber())
.pipe(babel({
presets: ['es2015'],
minified: true
}))
.pipe(optimizeJS())
.pipe(gulp.dest('dist'));
});
gulp.task('watch', function () {
watch(src, batch(function (events, done) {
gulp.start('compile', done);
}));
});
gulp.task('default', ['watch']);