forked from aszpecht/silion-exercise
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
36 lines (29 loc) · 856 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 gulp = require("gulp");
const sass = require("gulp-sass")(require("sass"));
const sourcemaps = require("gulp-sourcemaps");
const autoprefixer = require("gulp-autoprefixer");
const browserSync = require("browser-sync").create();
function compileSass(done) {
gulp
.src("scss/main.scss")
.pipe(sourcemaps.init())
.pipe(sass({ outputStyle: "expanded" }).on("error", sass.logError))
.pipe(autoprefixer())
.pipe(sourcemaps.write("."))
.pipe(gulp.dest("css"));
done();
}
function watcher(done) {
browserSync.init({
server: "./",
});
gulp.watch("scss/**/*.scss", gulp.series(compileSass, reload));
gulp.watch("*.html", gulp.series(reload));
done();
}
function reload(done) {
browserSync.reload();
done();
}
exports.sass = gulp.parallel(compileSass);
exports.default = gulp.parallel(compileSass, watcher);