-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
96 lines (88 loc) · 2.25 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
"use strict";
const gulp = require("gulp");
// TINYPNG
// npm i gulp-tinypng-extended && npm install gulp-plumber
var plumber = require("gulp-plumber");
var tinypng = require("gulp-tinypng-extended");
gulp.task("tiny", function () {
return gulp
.src("img/*.{png,jpg,jpeg}")
.pipe(plumber())
.pipe(
tinypng({
key: "3B8F7mxVmX0d325mbKTRJ0FJLj05Rwjs",
sigFile: "img/.tinypng-sigs",
log: true,
})
)
.pipe(gulp.dest("img/tiny/"));
});
// WEBP
// npm i gulp-webp
const webp = require("gulp-webp");
gulp.task("webp", () => gulp.src("webp/*.{png,jpg,jpeg}").pipe(webp()).pipe(gulp.dest("webp/webp")));
/* FAVICON */
// npm i gulp-real-favicon
var realFavicon = require("gulp-real-favicon");
var fs = require("fs");
// File where the favicon markups are stored
var FAVICON_DATA_FILE = "faviconData.json";
var fav;
gulp.task("fav", function (done) {
realFavicon.generateFavicon(
{
masterPicture: "fav/fav.png",
dest: "fav/",
iconsPath: "/",
design: {
ios: {
pictureAspect: "noChange",
assets: {
ios6AndPriorIcons: true,
ios7AndLaterIcons: true,
precomposedIcons: true,
declareOnlyDefaultIcon: true,
},
},
desktopBrowser: {},
windows: {
pictureAspect: "noChange",
backgroundColor: "#da532c",
onConflict: "override",
assets: {
windows80Ie10Tile: true,
windows10Ie11EdgeTiles: {
small: true,
medium: true,
big: true,
rectangle: true,
},
},
},
androidChrome: {
pictureAspect: "noChange",
themeColor: "#ffffff",
manifest: {
display: "standalone",
orientation: "notSet",
onConflict: "override",
declared: true,
},
assets: {
legacyIcon: true,
lowResolutionIcons: true,
},
},
},
settings: {
scalingAlgorithm: "Mitchell",
errorOnImageTooSmall: true,
},
markupFile: FAVICON_DATA_FILE,
},
function () {
done();
}
);
});
gulp.task("default", gulp.series("tiny"));