forked from sabberworm/Wok.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
58 lines (49 loc) · 1.07 KB
/
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
48
49
50
51
52
53
54
55
56
57
58
var gulp = require('gulp');
var karma = require('karma').server;
var del = require('del');
var stylish = require('jshint-stylish');
var p = require('gulp-load-plugins')();
gulp.task('clean', function(cb) {
del(['build'], cb);
});
gulp.task('check', function() {
return gulp.src([
'src/*.js',
'test/*.js'
]).pipe(
p.jshint()
).pipe(
p.jshint.reporter(stylish)
)
});
gulp.task('test', ['check'], function (done) {
var conf = {
configFile: __dirname + '/karma.conf.js',
singleRun: true
};
if('KARMA_BROWSER' in process.env) {
conf.browsers = [process.env.KARMA_BROWSER];
}
karma.start(conf, done);
});
gulp.task('minify', ['check'], function() {
return gulp.src(
'src/*.js'
).pipe(
p.sourcemaps.init({
includeContent: true
})
).pipe(
p.uglify()
).pipe(
p.rename({suffix: '.min'})
).pipe(
p.sourcemaps.write('./')
).pipe(gulp.dest('build'));
});
gulp.task('watch-test', ['test'], function() {
gulp.watch('test/*.js', ['test']);
});
gulp.task('watch', ['watch-test']);
gulp.task('build', ['minify']);
gulp.task('default', ['test', 'build']);