-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
45 lines (40 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
const gulp = require('gulp');
const gulp$babel = require('gulp-babel'),
gulp$eslint = require('gulp-eslint'),
gulp$rimraf = require('gulp-rimraf'),
gulp$strip = require('gulp-strip-debug'),
gulp$uglify = require('gulp-uglify');
gulp.task('clean', () => {
return gulp
.src(['dist/**/*.js', 'dist/**/*.js.map'], {
read: false
})
.pipe(gulp$rimraf({
force: true
}));
});
gulp.task('eslint', () => {
return gulp
.src(['src/**/*.js'])
.pipe(gulp$eslint())
.pipe(gulp$eslint.format())
.pipe(gulp$eslint.failAfterError());
});
gulp.task('dist', gulp.series('clean', () => {
const babelOptions = {
presets: [
[
'@babel/preset-env', {
modules: false
}
]
]
};
return gulp
.src(['src/**/*.js'])
.pipe(gulp$strip())
.pipe(gulp$babel(babelOptions))
.pipe(gulp$uglify())
.pipe(gulp.dest('dist'));
}));
gulp.task('default', gulp.series('clean', 'dist'));