forked from GitInsights/GitInsights
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgulpfile.js
54 lines (47 loc) · 1.15 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 concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var jshint = require('gulp-jshint');
var karma = require('karma').server
var nodemon = require('gulp-nodemon');
var paths = {
scripts: [
'client/*.js',
'client/app/scripts/**/*.js',
],
dist: 'client/app/dist'
}
gulp.task('default', ['lint', 'test', 'build', 'watch']);
// Lint js files
gulp.task('lint', function () {
gulp.src(paths.scripts)
.pipe(jshint())
.pipe(jshint.reporter('default'))
});
gulp.task('test', function (done) {
karma.start({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done);
});
// Uglify and Concat js files
gulp.task('build', function () {
gulp.src(paths.scripts)
.pipe(uglify())
.pipe(concat('scripts.min.js'))
.pipe(gulp.dest(paths.dist))
});
gulp.task('watch', function () {
gulp.watch(paths.scripts, ['lint', 'test', 'build']);
});
gulp.task('serve', function () {
nodemon({
script: 'index.js',
ext: 'html js',
ignore: ['node_modules']
})
.on('change', ['lint', 'test'])
.on('restart', function () {
console.log('restarting server');
});
});