Updated
This commit is contained in:
parent
baed4fd80e
commit
fec3abd5d8
15 changed files with 141 additions and 119 deletions
26
frontend/@dasig/scripts/node/generateFavicon.ts
Normal file
26
frontend/@dasig/scripts/node/generateFavicon.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// deno-lint-ignore-file no-explicit-any
|
||||
import { consola } from "consola";
|
||||
import * as fs from "node:fs";
|
||||
import * as path from "node:path";
|
||||
import sharp from "sharp";
|
||||
|
||||
try {
|
||||
const dirPath = path.resolve("./public");
|
||||
|
||||
if (fs.existsSync(dirPath)) {
|
||||
const inputSrc = "./src/images/favicon.png";
|
||||
const favicon = dirPath + "/favicon.png";
|
||||
const faviconBuffer = await sharp(inputSrc)
|
||||
.png({ quality: 90 })
|
||||
.resize(48)
|
||||
.toBuffer();
|
||||
await sharp(faviconBuffer).toFile(favicon);
|
||||
consola.success("Favicon generated successfully");
|
||||
} else {
|
||||
consola.error("Directory does not exist:", dirPath);
|
||||
}
|
||||
} catch (error: any) {
|
||||
if (error.message.includes("missing")) {
|
||||
consola.error("Source favicon does not exist");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue