-
Notifications
You must be signed in to change notification settings - Fork 10
/
gulpfile.js
54 lines (41 loc) · 1.11 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
var gulp = require('gulp');
var watch= require('gulp-watch');
var coffee= require('gulp-coffee');
var uglify= require('gulp-uglify');
var config={uglify:false}
var paths = {
coffee: ['coffee/docUtils.coffee','coffee/chartManager.coffee','coffee/index.coffee', 'coffee/chartMaker.coffee'],
coffeeTest: ['coffee/test.coffee'],
testDirectory:__dirname+'/test',
js:'js/'
};
gulp.task('allCoffee', function () {
gulp.src(paths.coffee)
.pipe(coffee({bare:true}))
.pipe(gulp.dest(paths.js))
a=gulp.src(paths.coffeeTest)
.pipe(coffee({map:true}))
if(config.uglify)
a=a.pipe(uglify())
a=a
.pipe(gulp.dest(paths.testDirectory));
});
gulp.task('watch', function () {
gulp.src(paths.coffee)
.pipe(watch(function(files) {
var f=files.pipe(coffee({bare:true}))
.pipe(gulp.dest(paths.js))
return f;
}));
gulp.watch(paths.coffeeTest,['coffeeTest']);
});
gulp.task('coffeeTest', function() {
a=gulp.src(paths.coffeeTest)
.pipe(coffee({map:true}))
if(config.uglify)
a=a.pipe(uglify())
a=a
.pipe(gulp.dest(paths.testDirectory));
return a;
});
gulp.task('default',['coffeeTest','watch']);