-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGulpfile.js
50 lines (43 loc) · 1.27 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
var gulp = require('gulp')
var sass = require('gulp-sass')
var nodemon = require('gulp-nodemon')
var browserSync = require('browser-sync').create()
gulp.task('browser-sync', ['nodemon'], function() {
return browserSync.init({
proxy: 'localhost:8000',
ws: true,
port: 5000,
open: false,
notify: true,
ghostMode: false
})
})
gulp.task('nodemon', function(cb) {
var called = false;
var stream = nodemon({
script: 'server.js'
})
stream.on('start', function() {
if (!called) {
called = true;
cb()
}
})
.on('crash', function() {
console.error('Crashed for whatever reason yo, gimme like 10 seconds and ill start back up')
stream.emit('restart', 10)
})
return stream
})
gulp.task('sass', function() {
return gulp.src('./client/scss/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./client/css'))
.pipe(browserSync.stream())
})
gulp.task('watch', function() {
gulp.watch('./client/scss/*.scss', ['sass'])
gulp.watch('./client/**/*.js').on('change', browserSync.reload)
gulp.watch('./client/**/*.html').on('change', browserSync.reload)
})
gulp.task('default', ['browser-sync', 'watch'])