-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgulpfile.js
More file actions
40 lines (34 loc) · 1.06 KB
/
gulpfile.js
File metadata and controls
40 lines (34 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
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var mocha = require('gulp-mocha');
var gutil = require('gulp-util');
gulp.task('jshint', function () {
return gulp.src(['src/**', 'test/**'])
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'));
});
gulp.task('build', function () {
return gulp.src(['src/**.js'])
.pipe(gulp.dest('dist'));
});
gulp.task('compress', ['build'], function () {
return gulp.src(['dist/**.js', '!dist/**.min.js'])
.pipe(uglify({ preserveComments: 'license' }))
.pipe(rename({
extname: '.min.js'
}))
.pipe(gulp.dest('dist'));
});
gulp.task('mocha', function() {
return gulp.src(['test/*.js'], { read: false })
.pipe(mocha({ reporter: 'list' }))
.on('error', gutil.log);
});
gulp.task('watch', function() {
gulp.watch(['src/**', 'test/**'], ['default']);
});
gulp.task('default', ['jshint', 'mocha', 'build', 'compress']);