forked from Tsane86/TM1-Tues-4pm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·58 lines (49 loc) · 1.4 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
55
56
57
58
const gulp = require("gulp"),
sass = require("gulp-sass"),
sourcemaps = require("gulp-sourcemaps"),
browserSync = require("browser-sync").create(),
csso = require("gulp-csso");
(source = "./process/"), (dest = "./builds/ehealthcare/");
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)
)
// Minify the file
.pipe(csso())
.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);