-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
36 lines (32 loc) · 922 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
const {src, dest, watch} = require("gulp")
const sass = require("gulp-sass")
const browserSync = require("browser-sync").create()
const gulpStylelint = require("gulp-stylelint")
const gulpCleanCss = require("gulp-clean-css")
function style() {
return src('./css/**/*.scss')
.pipe(gulpStylelint({
reporters: [
{
formatter: 'string',
console: true
}
]
}))
.pipe(sass().on('error', sass.logError))
.pipe(gulpCleanCss())
.pipe(dest('./css'))
.pipe(browserSync.stream())
}
function watcher (){
browserSync.init({
server: {
baseDir: "./"
}
})
watch('./css/**/*.scss', style)
watch('./*.html').on('change', browserSync.reload)
watch('.js//**/*.js').on('change', browserSync.reload)
}
exports.style = style
exports.watch = watcher