-
Notifications
You must be signed in to change notification settings - Fork 12
/
gulpfile.js
47 lines (41 loc) · 1.05 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
const gulp = require('gulp');
const stylus = require('gulp-stylus');
const nodemon = require('gulp-nodemon');
const browserSync = require('browser-sync');
const { reload } = browserSync;
const config = require('./config/config');
gulp.task('stylus', () => {
gulp.src('./public/styl/*.styl')
.pipe(stylus())
.pipe(gulp.dest('./public/css'))
.pipe(reload({ stream: true }));
});
gulp.task('watch', () => {
gulp.watch('./public/styl/*.styl', ['stylus']);
});
gulp.task('browser-sync', ['nodemon'], () => {
browserSync.init(null, {
proxy: `http://localhost:${config.server.port}`,
files: ['public/**/*.*', '**.js'],
browser: 'google chrome',
port: 7000,
});
});
gulp.task('nodemon', cb => nodemon({
exec: 'node --inspect',
script: 'app.js',
ext: 'js pug',
env: { NODE_ENV: 'development', DEBUG: 'myapp:*' },
})
.once('start', cb)
.on('restart', () => {
setTimeout(() => {
browserSync.reload({ stream: false });
}, 1000);
}));
gulp.task('default', [
'stylus',
'nodemon',
'watch',
'browser-sync',
]);