-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
48 lines (42 loc) · 1.06 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
var gulp = require('gulp'),
inject = require('gulp-inject'),
karma = require('gulp-karma'),
connect = require('gulp-connect');
var paths = {
html: ['app/**/*.html'],
scripts: ['app/modules/**/*.module.js', 'app/modules/**/*.js', '!app/modules/**/*.test.js'],
unitTests: ['app/modules/**/*.test.js']
};
gulp.task('inject', function(){
return gulp.src('app/index.html')
.pipe(inject(gulp.src(paths.scripts, {read:false}),{
ignorePath:'/app'
}))
.pipe(gulp.dest('./app'));
});
gulp.task('test', function(){
return gulp.src('./foo')
.pipe(karma({
configFile: 'karma.conf.js',
action: 'run'
}))
.on('error', function(err){
console.log(err);
this.emit('end');
});
});
gulp.task('serve', function(){
connect.server({
root: 'app',
livereload: true
});
});
gulp.task('html', function () {
gulp.src(paths.html)
.pipe(connect.reload());
});
gulp.task('dev', ['inject', 'test', 'serve'], function(){
gulp.watch(paths.scripts, ['inject', 'test', 'html']);
gulp.watch(paths.unitTests, ['test']);
gulp.watch(paths.html, ['html']);
});