forked from MilkZoft/MakingDevelopers
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.babel.js
More file actions
62 lines (54 loc) · 1.23 KB
/
gulpfile.babel.js
File metadata and controls
62 lines (54 loc) · 1.23 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
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';
// Linter task
gulp.task('eslint', () => {
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'));
});
gulp.task('livereload', () => {
livereload({ start: true });
});
gulp.task('start-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...'));
});
});
// Start production
gulp.task('start', () => {
nodemon({
script: 'src/server.js',
ext: 'js',
env: {
'NODE_ENV': 'production'
}
});
});
gulp.task('default', ['livereload', 'start-dev']);