/
gulpfile.js
75 lines (63 loc) · 1.59 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
(function() {
'use strict';
var gulp = require('gulp'),
runSequence = require('run-sequence'),
plugin = require('gulp-load-plugins')(),
env = process.env.NODE_ENV || 'development';
gulp.task('clean', plugin.shell.task([
// 'rm -rf public/',
'rm -rf built/'
]));
gulp.task('jshint', function() {
gulp.src([
'{,*/}*.js',
'src/{,*/}*.js',
'js/{,*/}*.js',
'!js/libs/{,*/}*.js',
'!public/{,*/}*.js',
'!FeedMe/{,*/}*.js'
])
.pipe(plugin.plumber(function(err) {
console.log('\x07');
}))
.pipe(plugin.jshint())
.pipe(plugin.jshint.reporter(plugin.stylish))
// No JS shall pass (if it is broken)!
.pipe(plugin.jshint.reporter('fail'));
});
/*
**
** DEVELOPMENT
**
**/
gulp.task('nodemon', function() {
plugin.nodemon({
script: 'app.js',
ext: 'js',
watch: ['app.js', '.'],
nodeArgs: ['--debug'],
env: { 'NODE_ENV': env }
})//.on('restart', function() {
// gulp.start('jshint');
//});
});
gulp.task('repo:setup', ['npm:install']);
gulp.task('npm:install', plugin.shell.task([
'npm prune',
'npm install'
]));
gulp.task('js', function() {
gulp.src(['./js/{,*/}*.js'])
.pipe(gulp.dest('./public/js'));
});
gulp.task('livereload', function() {
plugin.livereload.changed();
});
gulp.task('watch', function() {
plugin.livereload.listen();
plugin.watch('**/*.js', ['js', 'livereload']);
});
gulp.task('default', function() {
runSequence('clean', 'repo:setup', ['nodemon', 'watch']);
});
})();