Robert Kaussow
d4d5204f37
All checks were successful
continuous-integration/drone/push Build is passing
130 lines
3.0 KiB
JavaScript
130 lines
3.0 KiB
JavaScript
const gulp = require("gulp");
|
|
const rename = require("gulp-rename");
|
|
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();
|
|
});
|
|
|
|
gulp.task("favicon-svg", function () {
|
|
return gulp
|
|
.src("src/favicon/favicon-main.svg")
|
|
.pipe(rename("favicon.svg"))
|
|
.pipe(gulp.dest("static/favicon/"));
|
|
});
|
|
|
|
gulp.task("favicon-generate", function (done) {
|
|
realFavicon.generateFavicon(
|
|
{
|
|
masterPicture: "src/favicon/favicon-main.svg",
|
|
dest: "static/favicon",
|
|
iconsPath: "/favicon",
|
|
design: {
|
|
ios: {
|
|
pictureAspect: "backgroundAndMargin",
|
|
backgroundColor: "#2f333e",
|
|
margin: "32%",
|
|
assets: {
|
|
ios6AndPriorIcons: true,
|
|
ios7AndLaterIcons: true,
|
|
precomposedIcons: false,
|
|
declareOnlyDefaultIcon: true,
|
|
},
|
|
},
|
|
desktopBrowser: {
|
|
design: "raw",
|
|
},
|
|
windows: {
|
|
pictureAspect: "whiteSilhouette",
|
|
backgroundColor: "#2f333e",
|
|
onConflict: "override",
|
|
assets: {
|
|
windows80Ie10Tile: false,
|
|
windows10Ie11EdgeTiles: {
|
|
small: true,
|
|
medium: true,
|
|
big: true,
|
|
rectangle: true,
|
|
},
|
|
},
|
|
},
|
|
androidChrome: {
|
|
pictureAspect: "backgroundAndMargin",
|
|
margin: "19%",
|
|
backgroundColor: "#2f333e",
|
|
themeColor: "#2f333e",
|
|
manifest: {
|
|
name: "the Geeklab",
|
|
display: "standalone",
|
|
orientation: "notSet",
|
|
onConflict: "override",
|
|
declared: true,
|
|
},
|
|
assets: {
|
|
legacyIcon: false,
|
|
lowResolutionIcons: false,
|
|
},
|
|
},
|
|
safariPinnedTab: {
|
|
pictureAspect: "silhouette",
|
|
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",
|
|
gulp.series(
|
|
"clean",
|
|
"prepare",
|
|
"favicon-svg",
|
|
"favicon-generate",
|
|
"favicon-check-update"
|
|
)
|
|
);
|