-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
executable file
·56 lines (49 loc) · 1.1 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
/**
* Created by Denis Bondarenko <[email protected]> on 08.05.2015.
*/
'use strict';
var gulp =require('gulp'),
util =require('gulp-util'),
changed=require('gulp-changed'),
rename =require('gulp-rename'),
srcmaps=require('gulp-sourcemaps'),
babel =require('gulp-babel'),
mocha =require('gulp-mocha'),
plumber=require('gulp-plumber'),
path =require('path')
;
var d ={
js :{
src :'lib.src/*.es7.js',
dst :'lib/',
maps :'maps/'
},
tst :{
main :'test/main.js'
}
};
gulp.task('js',function(){
return gulp.src(d.js.src)
.pipe(plumber())
.pipe(changed(d.js.dst))
.pipe(srcmaps.init())
.pipe(babel({stage:0}))
.pipe(srcmaps.write(d.js.maps))
.pipe(rename(function(path){
path.basename=path.basename.replace('.es7','');
}))
.pipe(gulp.dest(d.js.dst));
});
gulp.task('test',['js'],function(){
return gulp.src(d.tst.main,{read:false})
.pipe(mocha({
reporter :'dot',
ui :'bdd'
}));
});
gulp.task('debug',['js'],function(){
});
gulp.task('watch',function(){
gulp.watch(d.js.src,['js']);
});
gulp.task('default',['watch','js']);