mirror of
https://github.com/GenderDysphoria/GenderDysphoria.fyi.git
synced 2025-01-30 23:06:18 +00:00
2f90e668cd
* Node 16: fix build dependencies * Node 16: fix Bootstrap dependency problem * Node 16: fix error in HTML writer * Node 16: move await to proper place (h/t alliejones)
46 lines
861 B
JavaScript
46 lines
861 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;
|
|
};
|