2021-08-31 08:34:30 +00:00
|
|
|
const gulp = require("gulp");
|
2021-10-04 13:40:09 +00:00
|
|
|
const rename = require("gulp-rename");
|
2021-08-31 08:34:30 +00:00
|
|
|
const realFavicon = require("gulp-real-favicon");
|
|
|
|
|
|
|
|
const fs = require("fs");
|
|
|
|
const del = require("del");
|
|
|
|
const through = require("through2");
|
|
|
|
|
|
|
|
var BUILD = "build";
|
|
|
|
var FAVICON_DATA_FILE = BUILD + "/faviconData.json";
|
|
|
|
|
|
|
|
function noop() {
|
|
|
|
return through.obj();
|
|
|
|
}
|
|
|
|
|
|
|
|
gulp.task("prepare", function (done) {
|
|
|
|
if (!fs.existsSync(BUILD)) {
|
|
|
|
fs.mkdirSync(BUILD, {
|
|
|
|
recursive: true,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
|
2021-10-04 13:40:09 +00:00
|
|
|
gulp.task("favicon-svg", function () {
|
|
|
|
return gulp
|
|
|
|
.src("src/favicon/favicon-main.svg")
|
|
|
|
.pipe(rename("favicon.svg"))
|
|
|
|
.pipe(gulp.dest("static/favicon/"));
|
|
|
|
});
|
|
|
|
|
2021-08-31 08:34:30 +00:00
|
|
|
gulp.task("favicon-generate", function (done) {
|
|
|
|
realFavicon.generateFavicon(
|
|
|
|
{
|
|
|
|
masterPicture: "src/favicon/favicon-main.svg",
|
|
|
|
dest: "static/favicon",
|
|
|
|
iconsPath: "/favicon",
|
|
|
|
design: {
|
|
|
|
ios: {
|
|
|
|
pictureAspect: "backgroundAndMargin",
|
2021-10-04 13:40:09 +00:00
|
|
|
backgroundColor: "#2f333e",
|
|
|
|
margin: "32%",
|
2021-08-31 08:34:30 +00:00
|
|
|
assets: {
|
2021-10-04 13:40:09 +00:00
|
|
|
ios6AndPriorIcons: true,
|
|
|
|
ios7AndLaterIcons: true,
|
2021-08-31 08:34:30 +00:00
|
|
|
precomposedIcons: false,
|
|
|
|
declareOnlyDefaultIcon: true,
|
|
|
|
},
|
|
|
|
},
|
2021-10-04 13:40:09 +00:00
|
|
|
desktopBrowser: {
|
|
|
|
design: "raw",
|
|
|
|
},
|
2021-08-31 08:34:30 +00:00
|
|
|
windows: {
|
2021-10-04 13:40:09 +00:00
|
|
|
pictureAspect: "whiteSilhouette",
|
|
|
|
backgroundColor: "#2f333e",
|
2021-08-31 08:34:30 +00:00
|
|
|
onConflict: "override",
|
|
|
|
assets: {
|
|
|
|
windows80Ie10Tile: false,
|
|
|
|
windows10Ie11EdgeTiles: {
|
|
|
|
small: true,
|
|
|
|
medium: true,
|
|
|
|
big: true,
|
|
|
|
rectangle: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
androidChrome: {
|
2021-10-04 13:40:09 +00:00
|
|
|
pictureAspect: "backgroundAndMargin",
|
|
|
|
margin: "19%",
|
|
|
|
backgroundColor: "#2f333e",
|
2021-08-31 08:34:30 +00:00
|
|
|
themeColor: "#2f333e",
|
|
|
|
manifest: {
|
2021-10-04 13:40:09 +00:00
|
|
|
name: "the Geeklab",
|
2021-08-31 08:34:30 +00:00
|
|
|
display: "standalone",
|
|
|
|
orientation: "notSet",
|
|
|
|
onConflict: "override",
|
|
|
|
declared: true,
|
|
|
|
},
|
|
|
|
assets: {
|
|
|
|
legacyIcon: false,
|
|
|
|
lowResolutionIcons: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
safariPinnedTab: {
|
2021-10-04 13:40:09 +00:00
|
|
|
pictureAspect: "silhouette",
|
2021-08-31 08:34:30 +00:00
|
|
|
themeColor: "#4186c9",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
settings: {
|
|
|
|
scalingAlgorithm: "Mitchell",
|
|
|
|
errorOnImageTooSmall: false,
|
|
|
|
readmeFile: false,
|
|
|
|
htmlCodeFile: false,
|
|
|
|
usePathAsIs: false,
|
|
|
|
},
|
|
|
|
markupFile: FAVICON_DATA_FILE,
|
|
|
|
},
|
|
|
|
function () {
|
|
|
|
done();
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
gulp.task("favicon-check-update", function (done) {
|
|
|
|
var currentVersion = JSON.parse(fs.readFileSync(FAVICON_DATA_FILE)).version;
|
|
|
|
realFavicon.checkForUpdates(currentVersion, function (err) {
|
|
|
|
if (err) {
|
|
|
|
throw err;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
|
|
|
|
gulp.task("clean", function () {
|
|
|
|
return del([BUILD, "static/favicon/", "resources"]);
|
|
|
|
});
|
|
|
|
|
|
|
|
/* Task series */
|
|
|
|
|
|
|
|
gulp.task(
|
|
|
|
"favicon",
|
2021-10-04 13:40:09 +00:00
|
|
|
gulp.series(
|
|
|
|
"clean",
|
|
|
|
"prepare",
|
|
|
|
"favicon-svg",
|
|
|
|
"favicon-generate",
|
|
|
|
"favicon-check-update"
|
|
|
|
)
|
2021-08-31 08:34:30 +00:00
|
|
|
);
|