-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
40 lines (32 loc) · 940 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
37
38
39
40
'use strict'
const gulp = require('gulp');
const babel = require('gulp-babel');
const rename = require('gulp-rename');
const uglify = require('gulp-uglify');
const eslint = require('gulp-eslint');
const path = require('path');
const source_dir = path.join('.', 'src');
const dist_dir = path.join('.', 'dist');
gulp.task('lint', () => {
return gulp.src(`${source_dir}/*.js`)
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('javascript', () => {
return gulp.src(`${source_dir}/*.js`)
.pipe(babel({
presets: ['env'],
plugins: [
'check-es2015-constants',
'transform-es2015-block-scoping',
]
}))
.pipe(uglify())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest(dist_dir))
})
gulp.task('default', ['lint', 'javascript']);
gulp.task('watch', function() {
gulp.watch(`${source_dir}/*.js`, ['lint', 'javascript'])
})