-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
49 lines (40 loc) · 1.2 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
import gulp from "gulp";
import connect from "gulp-connect";
import concat from "gulp-concat";
import htmlMinifier from "gulp-htmlmin";
import cssMinifier from "gulp-clean-css";
import imageMinifier from "gulp-imagemin";
const minifyHTML = () =>
gulp
.src("examples/e-commerce/*.html")
.pipe(htmlMinifier({ collapseWhitespace: true }))
.pipe(gulp.dest("build/"))
.pipe(connect.reload());
const watchHTML = () =>
gulp.watch(
"examples/e-commerce/*.html",
{ ignoreInitial: false },
minifyHTML
);
const bundleCSS = () =>
gulp
.src("src/*.css")
.pipe(concat("fluent.min.css"))
.pipe(cssMinifier())
.pipe(gulp.dest("build/"))
.pipe(connect.reload());
const watchCSS = () =>
gulp.watch("src/*.css", { ignoreInitial: false }, bundleCSS);
const bundleImages = () =>
gulp
.src("examples/e-commerce/images/*.png")
.pipe(imageMinifier())
.pipe(gulp.dest("build/images/"));
const connectServer = () =>
connect.server({
root: "build/",
livereload: true,
});
export const compressDemoImages = () =>
gulp.src("demo/*.png").pipe(imageMinifier()).pipe(gulp.dest("demo/"));
export default gulp.parallel(watchHTML, watchCSS, bundleImages, connectServer);