-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
46 lines (39 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
var gulp = require('gulp');
var watch = require('gulp-watch');
var sass = require('gulp-sass');
var pug = require('gulp-pug');
var gulp_watch_pug = require('gulp-watch-pug');
var connect = require('gulp-connect');
var config = {
publicDir: 'public'
}
gulp.task('connect', function() {
connect.server({
root: 'public',
livereload: true
});
});
gulp.task('sass', function() {
return gulp.src('scss/*.scss')
.pipe(sass({
errLogToConsole: true
}))
.pipe(gulp.dest(config.publicDir + '/css'));
});
gulp.task('views', function buildHTML() {
gulp.src('views/*.pug')
.pipe(watch('views/*.pug'))
.pipe(gulp_watch_pug('views/*.pug', { delay: 100 }))
.pipe(pug())
.pipe(gulp.dest('public'));
});
gulp.task('livereload', function() {
gulp.src('public/**/*')
.pipe(connect.reload());
});
gulp.task('watch', function() {
gulp.watch('scss/**/*.scss', ['sass']);
gulp.watch('views/**/*.pug', ['views']);
gulp.watch(config.publicDir + '/**/*', ['livereload']);
});
gulp.task('default', ['connect', 'watch', 'sass']);