-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
46 lines (40 loc) · 1.21 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
var gulp = require('gulp'),
gutil = require('gulp-util'),
jshint = require('gulp-jshint'),
mocha = require('gulp-mocha'),
rimraf = require('gulp-rimraf'),
uglify = require('gulp-uglify'),
browserify = require('browserify'),
source = require('vinyl-source-stream'),
buffer = require('vinyl-buffer'),
beep = require('beepbeep');
gulp.task('default',['watch-test']);
gulp.task('test', function(){
return gulp.src(['test/*.js'], {read: false})
.pipe(mocha({reporter: 'spec'}))
.on('error', function(err){
beep(2);
gutil.log(err);
process.exit.bind(process, 1);
});
});
gulp.task('watch-test', function(){
gulp.watch(['lib/**', 'test/**', 'index.js'], ['test']);
});
gulp.task('lint', function(){
return gulp.src(['./lib/*.js','./index.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('build', function() {
return browserify('./index.js')
.bundle()
.pipe(source('runnr-workout.min.js'))
.pipe(buffer())
.pipe(uglify())
.pipe(gulp.dest('./build/client/'));
});
gulp.task('clean', function () {
return gulp.src('./build/**/*.*', { read: false })
.pipe(rimraf());
});