forked from collinadams/BarHawk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
75 lines (65 loc) · 1.7 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
//include gulp
var gulp = require('gulp');
//server for testing
var Server = require('karma').Server;
//plugins
var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var cssmin = require('gulp-cssmin');
var minify = require('gulp-minify');
var nodemons = require('gulp-nodemon');
var bootlint = require('gulp-bootlint');
//Lint Task
gulp.task('lint', function (cb) {
return gulp.src('client/app/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'));
cb(err);
});
//Bootlint Task
gulp.task('bootlint', ['lint'], function (cb){
return gulp.src('client/app/index.html')
.pipe(bootlint({
stoponerror: true,
stoponwarning: true,
loglevel: 'debug'
}));
cb(err)
});
//CSS minify
gulp.task('minify-css', ['bootlint'], function (cb) {
return gulp.src('client/styles/*.css')
.pipe(cssmin())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('client/dist'));
cb(err);
});
//Concatenate and Minify JS
gulp.task('scripts', ['minify-css'], function (cb) {
return gulp.src('client/app/**/*.js')
.pipe(concat('all.js'))
.pipe(gulp.dest('client/dist'));
cb(err);
});
//testing
gulp.task('test', ['scripts'], function (done) {
new Server({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done).start();
});
//run nodemon
gulp.task('server', ['test'], function () {
nodemons({
script: 'server/server.js',
ext: 'js html',
});
});
//Watch files
gulp.task('watch', ['server'], function () {
gulp.watch('js/*.js', ['lint', 'scripts']);
});
//default
gulp.task('default', ['lint', 'bootlint', 'minify-css', 'scripts', 'test', 'server', 'watch']);