aboutsummaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorLynithDev <61880709+LynithDev@users.noreply.github.com>2024-01-20 11:27:36 +0100
committerLynithDev <61880709+LynithDev@users.noreply.github.com>2024-01-20 11:27:36 +0100
commit0225e2e17d12a32467bc12f33b2402287c79e23f (patch)
tree9d542217953eb915b3a4da9799fd24b723281054 /apps
parent8be3434d32d7ed9046000377f7f9e59ef2a971b3 (diff)
downloadNexus-0225e2e17d12a32467bc12f33b2402287c79e23f.tar.gz
Nexus-0225e2e17d12a32467bc12f33b2402287c79e23f.tar.bz2
Nexus-0225e2e17d12a32467bc12f33b2402287c79e23f.zip
Fixed icon system
Diffstat (limited to 'apps')
-rw-r--r--apps/website/package.json1
-rw-r--r--apps/website/src/components/icons/Icon.astro6
-rw-r--r--apps/website/src/components/logos/Logo.astro7
3 files changed, 10 insertions, 4 deletions
diff --git a/apps/website/package.json b/apps/website/package.json
index e8c71c7..ef89b74 100644
--- a/apps/website/package.json
+++ b/apps/website/package.json
@@ -11,6 +11,7 @@
"test": "vitest"
},
"dependencies": {
+ "@astrojs/check": "^0.4.1",
"@astrojs/mdx": "^2.0.3",
"@astrojs/rss": "^4.0.1",
"@astrojs/sitemap": "^3.0.4",
diff --git a/apps/website/src/components/icons/Icon.astro b/apps/website/src/components/icons/Icon.astro
index b7442ab..f57ee4f 100644
--- a/apps/website/src/components/icons/Icon.astro
+++ b/apps/website/src/components/icons/Icon.astro
@@ -1,4 +1,5 @@
---
+import { readFile } from 'node:fs/promises';
import type { HTMLAttributes } from 'astro/types';
import { parse } from 'node-html-parser';
@@ -41,12 +42,13 @@ interface Props extends HTMLAttributes<'svg'> {
}
async function getSVG(name: string, path = 'impl') {
- const file = await import(`./${path}/${name}.svg?raw`);
+ const dir = new URL(`${path}`, import.meta.url).pathname;
+ const file = await readFile(`${dir}/${name}.svg`, { encoding: 'utf-8' });
if (!file)
throw new Error(`${name} not found`);
- const content = parse(file.default);
+ const content = parse(file);
const svg = content.querySelector('svg');
diff --git a/apps/website/src/components/logos/Logo.astro b/apps/website/src/components/logos/Logo.astro
index 7988092..6b085fa 100644
--- a/apps/website/src/components/logos/Logo.astro
+++ b/apps/website/src/components/logos/Logo.astro
@@ -1,4 +1,6 @@
---
+import { readFile } from 'node:fs/promises';
+import { join } from 'node:path';
import type { LogoType } from '@webtypes/Config';
import type { HTMLAttributes } from 'astro/types';
@@ -18,8 +20,9 @@ let svg: string | undefined;
try {
if (logo === undefined)
return;
- const dir = '../../../public/media';
- svg = (await import(/* @vite-ignore */ `${dir}/${logo.replaceAll('.', '/')}.svg?raw`)).default;
+
+ const dir = new URL(join('..', '..', '..', 'public', 'media'), import.meta.url).pathname;
+ svg = (await readFile(`${dir}/${logo.replaceAll('.', '/')}.svg`, { encoding: 'utf8' }));
if (svg === undefined)
return;