-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
34 lines (29 loc) · 826 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
const gulp = require("gulp");
const sass = require("gulp-sass");
const sourcemaps = require("gulp-sourcemaps");
const autoprefixer = require("gulp-autoprefixer");
const browserSync = require("browser-sync").create();
const sassOptions = {
outputStyle: "expanded"
};
// compile scss into css
function style() {
return gulp
.src("./scss/**/*.scss")
.pipe(sourcemaps.init())
.pipe(sass(sassOptions).on("error", sass.logError))
.pipe(sourcemaps.write())
.pipe(autoprefixer())
.pipe(gulp.dest("./css"))
.pipe(browserSync.stream());
}
function watch() {
browserSync.init({
server: "."
});
gulp.watch("./scss/**/*.scss", style);
gulp.watch("./*.html").on("change", browserSync.reload);
gulp.watch("./js/**/*.js", browserSync.reload);
}
exports.style = style;
exports.watch = watch;