-
Notifications
You must be signed in to change notification settings - Fork 217
/
gulpfile.js
executable file
·54 lines (45 loc) · 1.29 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"),
sourcemaps = require("gulp-sourcemaps"),
browserSync = require("browser-sync").create(),
source = "./process/",
dest = "./builds/sassEssentials/";
sass.compiler = require("node-sass");
function html() {
return gulp.src(dest + "**/*.html");
}
function js() {
return gulp.src(dest + "**/*.js");
}
function styles() {
return gulp
.src(source + "sass/style.scss")
.pipe(sourcemaps.init())
.pipe(
sass({
sourcemap: true,
style: "compressed"
}).on("error", sass.logError)
)
.pipe(gulp.dest(dest + "css"));
}
function watch() {
gulp.watch(dest + "js/**/*.js", js).on("change", browserSync.reload);
gulp.watch(source + "sass/**/*", styles).on("change", browserSync.reload);
gulp.watch(dest + "index.html", html).on("change", browserSync.reload);
}
function server() {
browserSync.init({
notify: false,
server: {
baseDir: dest
}
});
gulp
.watch(source + "sass/**/*.scss", styles)
.on("change", browserSync.reload);
gulp.watch(dest + "js/**/*.js", js).on("change", browserSync.reload);
gulp.watch(dest + "index.html", html).on("change", browserSync.reload);
}
var build = gulp.series(gulp.parallel(js, styles, html), server, watch);
gulp.task("default", build);