-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
39 lines (33 loc) · 1.03 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
const gulp = require("gulp");
const sass = require("gulp-sass")(require("sass"));
const rename = require("gulp-rename");
const cleanCSS = require("gulp-clean-css");
const autoPrefix = require("gulp-autoprefixer");
const concatenate = require("gulp-concat");
const imagemin = require("gulp-imagemin");
const sassFiles = ["./src/sass/main.scss"];
const imageFiles = ["./assets/*.+(png|jpg|gif|svg)"];
gulp.task("sass", () => {
return gulp
.src(sassFiles)
.pipe(sass())
.pipe(concatenate("styles.css"))
.pipe(gulp.dest("./public/css/"))
.pipe(autoPrefix())
.pipe(cleanCSS())
.pipe(rename("styles.min.css"))
.pipe(gulp.dest("./public/css/"));
});
gulp.task("images", () => {
return gulp
.src(imageFiles)
.pipe(imagemin())
.pipe(gulp.dest("./public/images/"));
});
gulp.task("build", gulp.parallel(["sass", "images"]));
gulp.task("watch", (done) => {
gulp.watch(sassFiles, gulp.series("sass"));
gulp.watch(imageFiles, gulp.series("images"));
done();
});
gulp.task("default", gulp.series("watch"));