thegeeklab/gulpfile.js
Robert Kaussow 2e64063da6
Some checks failed
continuous-integration/drone/pr Build is failing
feat: add new logo and favicon generation
2021-08-30 23:42:57 +02:00

108 lines
5.7 KiB
JavaScript

const gulp = require("gulp");
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("favicon-generate", function (done) {
realFavicon.generateFavicon(
{
masterPicture: "src/favicon/favicon-main.svg",
dest: "static/favicon",
iconsPath: "/favicon",
design: {
ios: {
pictureAspect: "backgroundAndMargin",
backgroundColor: "#4186c9",
margin: "0",
assets: {
ios6AndPriorIcons: false,
ios7AndLaterIcons: false,
precomposedIcons: false,
declareOnlyDefaultIcon: true,
},
},
desktopBrowser: {},
windows: {
masterPicture: {
type: "inline",
content:
"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgoKPHN2ZwogICB3aWR0aD0iNTAwIgogICBoZWlnaHQ9IjUwMCIKICAgdmlld0JveD0iMCAwIDEzMi4yOTE2NyAxMzIuMjkxNjciCiAgIHZlcnNpb249IjEuMSIKICAgaWQ9InN2ZzU1OSIKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4xIChjNjhlMjJjMzg3LCAyMDIxLTA1LTIzKSIKICAgc29kaXBvZGk6ZG9jbmFtZT0iYXZhdGFyX3Jhdy5zdmciCiAgIHhtbG5zOmlua3NjYXBlPSJodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy9uYW1lc3BhY2VzL2lua3NjYXBlIgogICB4bWxuczpzb2RpcG9kaT0iaHR0cDovL3NvZGlwb2RpLnNvdXJjZWZvcmdlLm5ldC9EVEQvc29kaXBvZGktMC5kdGQiCiAgIH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gogICAgICAgICBkPSJtIDEzMi43OTA2NCwyMDkuNTI0MjUgLTE0LjcxNTM1LDUuOTkwMzQgYyAtMS4xMTA5OSwwLjQ1MTI4IC0xLjg0NDY2LDEuNTU4MDIgLTEuODQ0NjYsMi43ODI5NiB2IDYuMTM1MzggYyAwLDEuMjY3OTIgMC43ODA4MywyLjM5NjE0IDEuOTQ0MjMsMi44MjU5NCBsIDE0LjcxNTM0LDUuMzY3MTMgYyAxLjkwMjMyLDAuNjkzMDUgMy45MDQxOSwtMC43NTIxNSAzLjkwNDE5LC0yLjgyNTk0IHYgLTE3LjQ5Mjg1IGMgLTAuMDA2LC0yLjExNjc3IC0yLjA4NTcyLC0zLjU2MTk3IC00LjAwMzc1LC0yLjc4Mjk2IHoiCiAgICAgICAgIGlkPSJwYXRoNDYiCiAgICAgICAgIHN0eWxlPSJmaWxsOiNmZmZmZmY7c3Ryb2tlLXdpZHRoOjAuNTMwNjA5IiAvPgogICAgPC9nPgogIDwvZz4KPC9zdmc+Cg==",
},
pictureAspect: "noChange",
backgroundColor: "#4186c9",
onConflict: "override",
assets: {
windows80Ie10Tile: false,
windows10Ie11EdgeTiles: {
small: true,
medium: true,
big: true,
rectangle: true,
},
},
},
androidChrome: {
pictureAspect: "shadow",
themeColor: "#2f333e",
manifest: {
display: "standalone",
orientation: "notSet",
onConflict: "override",
declared: true,
},
assets: {
legacyIcon: false,
lowResolutionIcons: false,
},
},
safariPinnedTab: {
pictureAspect: "blackAndWhite",
threshold: 58.75,
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(["static/favicon/", "resources"]);
});
/* Task series */
gulp.task(
"favicon",
gulp.series("clean", "favicon-generate", "favicon-check-update")
);