-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
62 lines (55 loc) · 1.45 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
import gulp from "gulp";
import imagemin from "gulp-imagemin";
import csso from "gulp-csso";
import htmlmin from "gulp-htmlmin";
import uglify from "gulp-uglify";
import browserify from "gulp-browserify";
import plumber from "gulp-plumber";
import babel from "gulp-babel";
const html = {
in: "./index.html",
out: "./dist",
},
js = {
in: "./src/js/**/*.*s",
out: "./dist/src/js",
name: "main.min.js",
},
css = {
in: "./src/css/**/*.css",
out: "./dist/src/css",
name: "main.min.css",
},
img = {
in: "./src/assets/**/*.*",
out: "./dist/src/assets",
};
// task for html
gulp.task("html", async function () {
gulp.src(html.in)
.pipe(plumber())
.pipe(htmlmin({ collapseWhitespace: true }))
.pipe(gulp.dest(html.out));
});
// task for css
gulp.task("css", async function () {
gulp.src(css.in).pipe(plumber()).pipe(csso()).pipe(gulp.dest(css.out));
});
// task for js
gulp.task("js", async function () {
gulp.src(js.in)
.pipe(plumber())
// .pipe(
// babel({
// presets: ["@babel/preset-env"],
// })
// )
//.pipe(uglify())
.pipe(gulp.dest(js.out));
});
// task for images
gulp.task("img", async function () {
gulp.src(img.in).pipe(plumber()).pipe(imagemin()).pipe(gulp.dest(img.out));
});
// task for
gulp.task("build", gulp.series("html", "css", "js", "img"));