-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
48 lines (40 loc) · 1.11 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
'use strict';
const gulp = require('gulp');
const sass = require('gulp-sass');
const nodemon = require('gulp-nodemon');
const browserSync = require('browser-sync');
const reload = browserSync.reload;
const pkg = require('./package.json');
gulp.task('nodemon', function (cb) {
var started = false;
return nodemon({
script : 'server.js',
args: ['-dev']
}).on('start', function () {
if (!started) {
cb();
started = true;
}
});
})
gulp.task('browser-sync', ['nodemon'], function() {
browserSync.init(null, {
proxy : 'http://localhost:3000',
files : ['./public/**/*.*'],
port : 3001
});
});
gulp.task('sass', function () {
return gulp.src('./scss/**/*.scss')
.pipe(sass({
errLogToConsole : true,
sourceComments : true,
}).on('error', sass.logError))
.pipe(gulp.dest('./public/css/'))
.pipe(reload({ stream : true }));
});
gulp.task('watch', function () {
gulp.watch('./scss/**/*.scss', ['sass']);
gulp.watch('./public/**/*.*').on('change', reload);
});
gulp.task('default', ['watch', 'sass', 'browser-sync']);