-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.babel.js
72 lines (63 loc) · 1.37 KB
/
gulpfile.babel.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
import eslint from 'gulp-eslint';
import gulp from 'gulp';
import livereload from 'gulp-livereload';
import nodemon from 'gulp-nodemon';
import notify from 'gulp-notify';
import stylus from 'gulp-stylus';
import mocha from 'gulp-mocha';
// Mocha task
gulp.task('test', () => {
return gulp.src([
'test/**/*.js'
])
.pipe(mocha());
});
// Linter Task
gulp.task('analyze', () => {
return gulp.src([
'src/**/*.js',
'!src/public/bower_components/**/*.js'
])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError())
});
// Stylus task
gulp.task('stylus', () => {
return gulp.src('src/stylus/style.styl')
.pipe(stylus({
compress: true
}))
.pipe(livereload())
.pipe(gulp.dest('src/public/css'));
});
// Livereload
gulp.task('livereload', () => {
livereload({ start:true });
});
// Start dev
gulp.task('star-dev', () => {
livereload.listen();
gulp.watch('src/stylus/*.styl', ['stylus']);
nodemon({
script: 'src/server.js',
ext: 'js',
env: {
'NODE_ENV': 'development'
}
}).on('restart', () => {
gulp.src('src/server.js')
.pipe(livereload())
.pipe(notify('Reloading page, please wait...'));
});
});
gulp.task('start', () => {
nodemon({
script: 'src/server.js',
ext: 'js',
env: {
'NODE_ENV': 'production'
}
});
});
gulp.task('default', ['livereload', 'star-dev']);