-
Notifications
You must be signed in to change notification settings - Fork 5
/
gulpfile.js
80 lines (70 loc) · 1.99 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
'use strict';
// Include gulp
var gulp = require('gulp');
// Include Our Plugins
var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var ngmin = require('gulp-ng-annotate');
var shell = require('gulp-shell');
var nodemon = require('gulp-nodemon');
var openAfterStart = require('gulp-open');
var Server = require('karma').Server;
// Lint Task
gulp.task('lint', function() {
return gulp.src('./public/app/**/*.js')
//.pipe(jshint())
.pipe(jshint.reporter('default'));
});
// Concatenate & Minify JS
gulp.task('js', function() {
return gulp.src('./public/app/**/*.js')
.pipe(concat('kinoa.js'))
.pipe(gulp.dest('./public/dist'))
.pipe(rename('kinoa.min.js'))
.pipe(ngmin())
.pipe(uglify())
//.pipe(gulp.dest('./dist'))
//.pipe(rev())
//.pipe(gulp.dest('./dist'))
//.pipe(rev.manifest())
.pipe(gulp.dest('./public/dist'));
});
// Watch Files For Changes
gulp.task('watch', function() {
return gulp.watch('./public/app/**/*.js', ['lint', 'js']);
// gulp.watch('scss/*.scss', ['sass']);
});
// start mongodb
gulp.task('mongodb', function() {
return gulp.src('')
.pipe(shell([
'exec scripts/startMongodb.sh'
]));
});
// start deployd
gulp.task('server', function () {
return nodemon({ script: 'index.js', ext: 'html js', ignore: ['./public/**'] })
.on('change', ['lint']);
});
// open browser
gulp.task('open', function() {
var options = {
url: 'http://localhost:3000'
};
return gulp.src('./public/index.html')
.pipe(openAfterStart('', options));
});
var Server = require('karma').Server;
/**
* Run test once and exit
*/
gulp.task('test', function (done) {
new Server({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done).start();
});
/* DEFAULT TASK */
gulp.task('default', ['lint', 'js', 'watch', 'mongodb', 'server', 'open']);