-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
47 lines (43 loc) · 1.12 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
var gulp = require('gulp');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
var nodemon = require('gulp-nodemon');
var sass = require('gulp-sass');
gulp.task('browser-sync', ['nodemon'], function () {
browserSync({
proxy: "localhost:3000", // local node app address
port: 8080, // use *different* port than above
notify: true,
browser: "google chrome"
});
});
gulp.task('nodemon', function (cb) {
var called = false;
return nodemon({
script: './bin/www',
ignore: [
'gulpfile.js',
'node_modules/'
]
})
.on('start', function () {
if (!called) {
called = true;
cb();
}
})
.on('restart', function () {
setTimeout(function () {
reload({ stream: false });
}, 1000);
});
});
gulp.task('sass', function () {
gulp.src('./public/sass/main.scss')
.pipe(sass({ outputStyle: 'compressed' }).on('error', sass.logError))
.pipe(gulp.dest('./public/css'));
});
gulp.task('default', ['browser-sync'], function () {
gulp.watch('**/*.scss', ['sass']);
gulp.watch(['**/*.{css,html,pug}'], reload);
});