-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
64 lines (55 loc) · 1.38 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
59
60
61
62
63
64
const gulp = require("gulp");
const concat = require("gulp-concat");
const autoprefixer = require("gulp-autoprefixer");
const cleanCSS = require("gulp-clean-css");
const uglify = require("gulp-uglify");
const del = require("del");
const browserSync = require("browser-sync").create();
const cssFiles = ["./src/css/swiper.min.css", "./src/css/styles.css"];
const jsFiles = [
"./src/js/swiper.min.js",
"./src/js/jquery.inputmask.min.js",
"./src/js/jquery.validate.min.js",
"./src/js/script.js",
];
function styles() {
return gulp
.src(cssFiles)
.pipe(concat("styles.min.css"))
.pipe(
autoprefixer({
cascade: false,
})
)
.pipe(cleanCSS({ compatibility: "ie8" }))
.pipe(gulp.dest("./build/css"))
.pipe(browserSync.stream());
}
function scripts() {
return gulp
.src(jsFiles)
.pipe(concat("scripts.min.js"))
.pipe(uglify())
.pipe(gulp.dest("./build/js"))
.pipe(browserSync.stream());
}
function watch() {
browserSync.init({
server: {
baseDir: "./",
},
});
gulp.watch("./src/css/**/*.css", styles);
gulp.watch("./src/js/**/*.js", scripts);
gulp.watch("./*.html", browserSync.reload);
}
function clean() {
return del(["build/*"]);
}
gulp.task("styles", styles);
gulp.task("scripts", scripts);
gulp.task("watch", watch);
gulp.task(
"default",
gulp.series(clean, gulp.parallel(styles, scripts), "watch")
);