-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathgulpfile.js
More file actions
71 lines (59 loc) · 1.79 KB
/
gulpfile.js
File metadata and controls
71 lines (59 loc) · 1.79 KB
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
var gulp = require('gulp');
var gutil = require('gulp-util');
var sass = require('gulp-sass');
var livereload = require('gulp-livereload');
var nodemon = require('gulp-nodemon');
var jshint = require('gulp-jshint');
var mocha = require('gulp-mocha');
var plumber = require('gulp-plumber');
var path = {
sassDir: './ionic/scss/**/*.scss',
sassSrc: './ionic/scss/ionic.app.scss',
cssRoot: './ionic/www/css',
server: './server/index.js',
serverSideJs: './server/**/*.js',
test: './test/**/*.js',
clientSideJs: './ionic/www/app/**/*.js'
}
gulp.task('sass', function () {
return gulp.src(path.sassSrc)
.pipe(plumber())
.pipe(sass())
.pipe(plumber.stop())
.pipe(gulp.dest(path.cssRoot));
});
gulp.task('watch', function() {
// watch scss files
gulp.watch(path.sassDir, ['sass']);
// Watch any files in dist/, reload on change
livereload.listen();
gulp.watch(path.clientSideJs).on('change', livereload.changed);
//watch for any changes made to js files in client and server
gulp.watch([path.clientSideJs, path.serverSideJs], ['lint']);
});
// TODO: watch out for dev mode vs prod mode
gulp.task('lint', function() {
return gulp.src([path.clientSideJs, path.serverSideJs])
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('mocha', function () {
return gulp.src(path.test)
.pipe(mocha({reporter: 'nyan'}));
});
gulp.task('mochaWatch', function() {
return gulp.watch(path.serverSideJs, ['mocha']);
})
gulp.task('expressDev', function() {
nodemon({
script: path.server,
})
.on('restart', function() {
console.log('restarted server');
});
});
/////////////Command-line API////////////////////////////
// $> gulp
gulp.task('default', ['lint', 'sass', 'watch', 'expressDev']);
// $> gulp test
gulp.task('test', ['mochaWatch', 'mocha']);