-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
37 lines (32 loc) · 904 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, dest, watch, series } = require("gulp");
const sass = require("gulp-sass")(require("sass"));
const postcss = require("gulp-postcss");
const cssnano = require("cssnano");
const browsersync = require("browser-sync");
// Sass Task
const scssTask = () => {
return src("./scss/style.scss", { sourcemaps: true })
.pipe(sass())
.pipe(postcss([cssnano]))
.pipe(dest("css", { sourcemaps: "." }));
};
// Browsersync Tasks
const browsersyncServe = (cb) => {
browsersync.init({
server: {
baseDir: ".",
},
});
cb();
};
const browsersyncReload = (cb) => {
browsersync.reload();
cb();
};
// Watch Task
const watchTask = () => {
watch("*.html", browsersyncReload);
watch("./scss/**/*.scss", series(scssTask, browsersyncReload));
};
// Default Gulp Task
exports.default = series(scssTask, browsersyncServe, watchTask);