Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import remarkToc from "remark-toc";
import remarkCollapse from "remark-collapse";
import sitemap from "@astrojs/sitemap";
import { SITE } from "./src/config";

Check failure on line 7 in astro.config.ts

View workflow job for this annotation

GitHub Actions / Code standards & build (18.x)

'SITE' is defined but never used

// https://astro.build/config
export default defineConfig({
Expand Down Expand Up @@ -53,6 +53,7 @@
// }
// }
// },
plugins: [rawFonts(['.ttf'])],
optimizeDeps: {
exclude: ["@resvg/resvg-js"],
},
Expand All @@ -66,3 +67,18 @@
// So we're instructing Astro to put the static build output in a folder of that name.
outDir: "./dist",
});

function rawFonts(ext) {
return {
name: 'vite-plugin-raw-fonts',
transform(_, id) {
if (ext.some(e => id.endsWith(e))) {
const buffer = fs.readFileSync(id);
return {
code: `export default ${JSON.stringify(buffer)}`,
map: null
};
}
}
};
}
50 changes: 48 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "emeraldjava.github.io",
"version": "2024.11.16",
"version": "2024.12.21",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
Expand All @@ -18,6 +18,7 @@
"@astrojs/rss": "^4.0.7",
"@giscus/react": "^3.0.0",
"@resvg/resvg-js": "^2.6.2",
"@vercel/og": "^0.6.4",
"astro": "^4.16.3",
"fuse.js": "^7.0.0",
"lodash.kebabcase": "^4.1.1",
Expand Down
22 changes: 14 additions & 8 deletions src/utils/loadGoogleFont.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,23 @@ async function loadGoogleFonts(
> {
const fontsConfig = [
{
name: "IBM Plex Mono",
font: "IBM+Plex+Mono",
name: "Space Mono",
font: "Space+Mono",
weight: 400,
style: "normal",
},
{
name: "IBM Plex Mono",
font: "IBM+Plex+Mono:wght@700",
weight: 700,
style: "bold",
},
// {
// name: "IBM Plex Mono",
// font: "IBM+Plex+Mono",
// weight: 400,
// style: "normal",
// },
// {
// name: "IBM Plex Mono",
// font: "IBM+Plex+Mono:wght@700",
// weight: 700,
// style: "bold",
// },
];

const fonts = await Promise.all(
Expand Down
Loading