-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
37 lines (32 loc) · 920 Bytes
/
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
const { src, watch, dest, parallel } = require('gulp')
const plumber = require('gulp-plumber')
const prefix = require('gulp-autoprefixer')
const browserSync = require('browser-sync').create()
const pug = require('gulp-pug')
const sass = require('gulp-sass')(require('sass'))
function browserSyncTask() {
browserSync.init({
notify: false,
server: {
baseDir: './'
}
})
watch('./src/views/**/*.pug', htmlTask)
watch('./src/scss/**/*.scss', cssTask)
watch('./src/js/**/*.js', browserSync.reload)
}
function htmlTask() {
return src('./src/views/*.pug')
.pipe(pug())
.pipe(dest('./'))
.on('end', browserSync.reload)
}
function cssTask() {
return src('./src/scss/main.scss')
.pipe(plumber([{ errorHandler: false }]))
.pipe(sass())
.pipe(prefix())
.pipe(dest('./'))
.pipe(browserSync.stream())
}
exports.default = parallel(browserSyncTask, htmlTask, cssTask)