-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
88 lines (75 loc) · 2.29 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
var gulp = require('gulp');
var stylus = require('gulp-stylus');
var connect = require('gulp-connect');
var nib = require('nib');
var open = require("gulp-open");
var inject = require("gulp-inject");
gulp.task('index', function() {
var target = gulp.src('./app/index.html');
return target
.pipe(inject(gulp.src(['./app/js/lib/angular.min.js',
'./app/js/lib/angular-local-storage.js',
'./app/js/lib/underscore-min.js',
'./app/js/mainApp/module.js',
'./app/js/mainApp/config.js',
'./app/js/mainApp/**/*.js',
'./app/js/checkersApp/module.js',
'./app/js/checkersApp/**/*.js',
'./app/js/app.js',
'./app/js/main.js'
]),{read:false}))
.pipe(gulp.dest('./app'));
});
gulp.task('connect', function() {
connect.server({
port: 8080,
livereload: true
});
});
gulp.task('watch', function() {
gulp.watch(['./app/css/**/*.styl'], ['stylus']);
gulp.watch(['./app/css/**/*.css'], ['reload-css']);
gulp.watch(['./app/js/**/*.js'], ['index', 'reload-js']);
gulp.watch(['./app/index.html', './app/js/**/*.html'], ['reload-html']);
});
gulp.task('stylus', function() {
gulp.src('./app/css/**/*.styl')
.pipe(stylus({
use: [nib()],
import: ['nib']
}))
.pipe(gulp.dest('./app/css'));
});
gulp.task('reload-js', function() {
gulp.src(['./app/js/**/*.js'])
.pipe(connect.reload());
});
gulp.task('reload-css', function() {
gulp.src(['./app/css/**/*.css'])
.pipe(connect.reload());
});
gulp.task('reload-html', function() {
gulp.src(['./app/index.html', './app/js/**/*.html'])
.pipe(connect.reload());
});
gulp.task("url", function() {
var options = {
url: "http://localhost:8080/app"
};
gulp.src("./app/index.html")
.pipe(open("./app/index.html", options));
});
var karma = require('gulp-karma');
gulp.task('test', function() {
return gulp.src('./foobar')
.pipe(karma({
configFile: 'karma.conf.js',
action: 'watch'
}))
.on('error', function(err) {
throw err;
});
});
gulp.task('default', function() {
gulp.run('connect', 'stylus', 'url', 'watch', 'test', 'index');
});