-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
54 lines (46 loc) · 1.28 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
54
const
gulp = require('gulp'),
sass = require('gulp-sass'),
browserSync = require("browser-sync").create(),
del = require('del'),
cache = require('gulp-cache'),
autoPrefixer = require('gulp-autoprefixer');
function gulpSass() {
return gulp
.src('./src/assets/scss/**/*.scss')
.pipe(sass({ outputStyle: "expanded" }))
.pipe(autoPrefixer({
browsers: ['last 4 versions'],
cascade: false
}))
.pipe(gulp.dest('./src/assets/css'))
.pipe(browserSync.stream());
}
function startServer(done) {
browserSync.init({
server: {
baseDir: "./src/"
},
});
done();
}
function clean() {
return del(["dist"]);
}
function clear() {
return cache.clearAll();
}
function reload(done) {
browserSync.reload();
done();
}
function watchFiles(done) {
gulp.watch('./src/assets/scss/**/*.scss', gulp.parallel(gulpSass));
gulp.watch('./src/assets/css/**/*.css', gulp.parallel(reload));
gulp.watch("./src/**/*.html", gulp.parallel(reload));
gulp.watch('./src/assets/js/**/*.js', gulp.parallel(reload));
done();
}
gulp.task('default',gulp.parallel(watchFiles, startServer));
exports.clean = clean;
exports.clear = clear;