-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgulpfile.js
More file actions
50 lines (43 loc) · 1.06 KB
/
Copy pathgulpfile.js
File metadata and controls
50 lines (43 loc) · 1.06 KB
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
require('babel-core/register');
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
rename = require('gulp-rename'),
uglify = require('gulp-uglify'),
del = require('del'),
babel = require('gulp-babel'),
mocha = require('gulp-mocha');
gulp.task('build', function() {
return gulp.src('lib/**/*.js')
.pipe(babel({
presets: ['es2015']
}))
.pipe(gulp.dest('dist'))
.pipe(rename({
suffix: '.min'
}))
.pipe(uglify())
.pipe(gulp.dest('dist'));
});
gulp.task('jshint', function() {
return gulp.src('lib/**/*.js')
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'))
});
gulp.task('test', ['jshint'], function() {
return gulp.src('test/**/*.js', {
read: false
})
.pipe(mocha({
reporter: 'spec'
}));
});
gulp.task('test-watch', function() {
gulp.watch(['lib/**', 'test/**'], ['test']);
});
gulp.task('clean', function() {
return del(['dist']);
});
gulp.task('default', ['jshint', 'test', 'clean'], function() {
gulp.start('build');
});