forked from DimensionDev/Maskbook-Website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.ts
70 lines (66 loc) · 1.73 KB
/
gulpfile.ts
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
65
66
67
68
69
70
import gulp from "gulp";
import sass from "gulp-sass";
import cssnano from "gulp-cssnano";
import px2rem from "gulp-px2rem";
import base64 from "gulp-base64";
import inline from "gulp-inline-source";
import rename from "gulp-rename";
import * as sprit from "sprit";
import path from "path";
gulp.task("default", () => {
gulp.watch("./assets/*.scss", gulp.parallel("build:css"));
});
gulp.task("build:css", () =>
gulp
.src("./assets/site.scss")
.pipe(sass())
.pipe(base64())
.pipe(cssnano())
.pipe(
px2rem({
rootValue: 16,
mediaQuery: true,
propertyBlackList: ["font-size", "background-image"],
})
)
.pipe(gulp.dest("./assets"))
);
gulp.task("build:links", () => gulp.src("./links/source.html").pipe(inline()).pipe(rename("index.html")).pipe(gulp.dest("./links")));
gulp.task(
"sprite",
gulp.parallel(
() =>
sprit.create({
src: "./img/sprite/brand-logos/*.png",
output: {
fileName: "./assets/sprite-brand-logos",
processor: "css",
options: {
prefix: ".brand-logo.",
omitFields: ["width", "height"],
naming(tile) {
const named = path.basename(tile.fileName, path.extname(tile.fileName));
return named.replace(/ /g, "-").toLowerCase();
},
},
},
}),
() =>
sprit.create({
src: "./img/meme/*.jpg",
renderer: {
scale: {
maximum: 365 * 2, // 200% DPI
},
},
output: {
fileName: "./assets/sprite-subculture",
processor: "css",
options: {
prefix: ".",
omitFields: ["width", "height"],
},
},
})
)
);