-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
65 lines (55 loc) · 1.26 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* global require module */
const sourceDir = 'src',
outputDir = 'bin';
const gulp = require('gulp'),
del = require('del'),
gulpSourceMaps = require('gulp-sourcemaps'),
gulpBabel = require('gulp-babel'),
gulpUglify = require('gulp-uglify'),
gulpEslint = require('gulp-eslint');
const clean = done => {
return del([outputDir], done);
};
const scriptsDebug = () =>
gulp.src(`${sourceDir}/**/*.js`)
.pipe(gulpSourceMaps.init())
.pipe(gulpBabel())
.pipe(gulpSourceMaps.write('.'))
.pipe(gulp.dest(`${outputDir}/`));
const scripts = () =>
gulp.src(`${sourceDir}/**/*.js`)
.pipe(gulpBabel())
.pipe(gulpUglify())
.pipe(gulp.dest(`${outputDir}/`));
const lint = () =>
gulp.src(`${sourceDir}/**/*.js`)
.pipe(gulpEslint())
.pipe(gulpEslint.format())
.pipe(gulpEslint.failAfterError());
const debug = gulp.series(
clean,
scriptsDebug,
lint
);
const build = gulp.series(
clean,
scripts
);
const develop = () => {
gulp.watch(
[
`${sourceDir}/**/*.js`
],
gulp.series(
scriptsDebug,
lint
)
);
};
module.exports = {
debug,
build,
develop,
lint,
default: build
};