-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathgulpfile.js
47 lines (38 loc) · 1015 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
41
42
43
44
45
46
47
let gulp = require('gulp');
let del = require('del');
let sourcemaps = require('gulp-sourcemaps');
let eslint = require('gulp-eslint');
let babel = require('gulp-babel');
const paths = {
base: './src',
build: './build',
script: {
src: './src',
dest: './build'
},
config: '../config/config.json'
};
gulp.task('default', ['build']);
gulp.task('build', [ 'lint', 'scripts', 'config']);
gulp.task('serve', ['build'], function() {
gulp.watch(paths.script.src + '/**/*.js', ['lint', 'scripts']);
});
gulp.task('clean', function() {
del([paths.build]);
});
gulp.task('lint', function () {
return gulp.src([paths.script.src + '/**/*.js'])
.pipe(eslint())
.pipe(eslint.format());
});
gulp.task('scripts', function() {
return gulp.src(paths.script.src + '/**/*.js')
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(paths.build));
});
gulp.task('config', function() {
gulp.src(paths.config)
.pipe(gulp.dest(paths.build));
});