mirror of
https://github.com/GenderDysphoria/GenderDysphoria.fyi.git
synced 2025-01-31 07:16:17 +00:00
46 lines
863 B
JavaScript
46 lines
863 B
JavaScript
|
|
||
|
const fs = require('fs-extra');
|
||
|
const actions = require('./actions');
|
||
|
const { resolve } = require('./resolve');
|
||
|
|
||
|
function any (input) {
|
||
|
for (const i of input) if (i) return i;
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
const MATCHES = [
|
||
|
'favicon.png',
|
||
|
'favicon.gif',
|
||
|
'favicon.jpeg',
|
||
|
'favicon.jpg',
|
||
|
];
|
||
|
|
||
|
module.exports = exports = async function favicon () {
|
||
|
|
||
|
const input = any(await Promise.all(
|
||
|
MATCHES.map((f) =>
|
||
|
fs.exists(resolve(f)).then((y) => y && f),
|
||
|
),
|
||
|
));
|
||
|
|
||
|
if (!input) return [];
|
||
|
|
||
|
// input = resolve(input);
|
||
|
const tasks = [ 32, 57, 64, 76, 96, 114, 120, 128, 144, 152, 180, 192, 196, 228 ].map((width) => ({
|
||
|
input,
|
||
|
output: `favicon${width}.png`,
|
||
|
format: 'png',
|
||
|
width,
|
||
|
action: actions.image,
|
||
|
}));
|
||
|
|
||
|
tasks.push({
|
||
|
input,
|
||
|
output: 'favicon.ico',
|
||
|
format: 'ico',
|
||
|
action: actions.image,
|
||
|
});
|
||
|
|
||
|
return tasks;
|
||
|
};
|