-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
53 lines (44 loc) · 1.34 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
51
52
53
var gulp = require('gulp'),
connect = require('gulp-connect'),
sass = require('gulp-ruby-sass'),
nodemon = require('gulp-nodemon');
gulp.task('connect',function(){
connect.server({
livereload: true,
port: 8005
});
});
gulp.task('reload',function(){
gulp.src('./dist/**/*.*')
.pipe(connect.reload());
});
gulp.task('js-process', function(){
gulp.src('./scripts/*.js')
.pipe(gulp.dest('dist/scripts'));
});
gulp.task('sass',function(){
return sass('./sass/*.scss')
.on('error',sass.logError)
.pipe(gulp.dest('dist/css'));
});
gulp.task('serve', function () {
nodemon({
script : 'server.js',
watch : 'server.js'
//...add nodeArgs: ['--debug=5858'] to debug
//..or nodeArgs: ['--debug-brk=5858'] to debug at server start
}).on('restart', function () {
setTimeout(function () {
gulp.src('./dist/**/*.*')
.pipe(connect.reload());
console.log('reload browsers!');
}, 300); // wait for the server to finish loading before restarting the browsers
});
});
gulp.task('watch',function(){
gulp.watch(['./sass/*.scss'], ['sass']);
gulp.watch(['./scripts/*.js'],['js-process']);
gulp.watch(['./dist/**/*.*'],['reload']);
gulp.watch(['./index.html'],['reload']);
});
gulp.task('default',['connect','watch','sass','js-process','serve']);