-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
43 lines (37 loc) · 886 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
// Load plugins
const gulp = require('gulp');
const $ = require('gulp-load-plugins')();
// Paths
const paths = {
src: 'src/**/*.js',
test: 'test/**/*.js',
dist: 'lib'
};
// Clean folders
gulp.task('clean', function() {
return gulp.src(paths.dist)
.pipe($.plumber())
.pipe($.clean());
});
// Lint scripts
gulp.task('lint', function() {
return gulp.src([paths.src])
.pipe($.plumber())
.pipe($.eslint())
.pipe($.eslint.format())
.pipe($.eslint.failAfterError());
});
// Build the library
gulp.task('build', ['clean', 'lint'], function() {
$.util.log('Building files...');
return gulp.src([paths.src])
.pipe($.plumber())
.pipe($.babel())
.pipe(gulp.dest(paths.dist));
});
// Watch
gulp.task('watch', ['lint'], function() {
gulp.watch([paths.src, paths.test], ['build']);
});
// Default task
gulp.task('default', ['build', 'watch']);