-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathgulpfile.js
More file actions
32 lines (27 loc) · 840 Bytes
/
gulpfile.js
File metadata and controls
32 lines (27 loc) · 840 Bytes
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
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var nodeunit = require('gulp-nodeunit');
var jshintTask = function (task, paths) {
gulp.task(task, function () {
gulp.src(paths)
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
};
gulp.task('test', function () {
gulp.src('test/**/*.js')
.pipe(nodeunit());
});
gulp.task('watch', function () {
gulp.watch(['lib/**/*.js', 'test/**/*.js'], ['jshint:lib', 'jshint:test', 'test']);
gulp.watch(['*.js', '*.json'], ['jshint:root']);
});
// setup tasks
jshintTask('jshint:root', ['*.js', '*.json']);
jshintTask('jshint:lib', 'lib/**/*.js');
jshintTask('jshint:test', 'test/**/*.js');
gulp.task('default', ['jshint:root', 'jshint:lib', 'jshint:test', 'test', 'watch']);
// handle errors
process.on('uncaughtException', function (e) {
console.error(e);
});