feat: initial release

This commit is contained in:
2026-02-03 20:41:44 +05:00
commit 021d9f3eda
30 changed files with 2021 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
import { building } from "$app/environment";
import { readdirSync } from "node:fs";
import { join } from "path";
export function loadFonts() {
try {
const fontsDir = join(process.cwd(), "static", "fonts");
console.log(fontsDir);
const files = readdirSync(fontsDir);
console.log(files);
let fonts = files
.filter((file) => /\.(woff2|woff|ttf|otf)$/i.test(file))
.map((file) => ({
name: file.replace(/\.[^/.]+$/, ""),
file,
url: `/fonts/${file}`,
format: getFormat(file),
}));
return fonts;
} catch (error) {
console.log("err");
return [];
}
}
function getFormat(filename: string) {
if (filename.endsWith(".woff2")) return "woff2";
if (filename.endsWith(".woff")) return "woff";
if (filename.endsWith(".ttf")) return "truetype";
return "opentype";
}
+16
View File
@@ -0,0 +1,16 @@
import { building } from "$app/environment";
import { readdirSync } from "node:fs";
import { join } from "path";
export function loadImages() {
try {
const imagesDir = join(process.cwd(), "static", "backgrounds");
const files = readdirSync(imagesDir);
let fonts = files.filter((file) => /\.(png|jpg)$/i.test(file));
return fonts;
} catch (error) {
return [];
}
}