Skip to content

Commit d774e08

Browse files
committed
Add vercel image generation.
1 parent 88529bd commit d774e08

File tree

4 files changed

+80
-11
lines changed

4 files changed

+80
-11
lines changed

astro.config.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export default defineConfig({
5353
// }
5454
// }
5555
// },
56+
plugins: [rawFonts(['.ttf'])],
5657
optimizeDeps: {
5758
exclude: ["@resvg/resvg-js"],
5859
},
@@ -66,3 +67,18 @@ export default defineConfig({
6667
// So we're instructing Astro to put the static build output in a folder of that name.
6768
outDir: "./dist",
6869
});
70+
71+
function rawFonts(ext) {
72+
return {
73+
name: 'vite-plugin-raw-fonts',
74+
transform(_, id) {
75+
if (ext.some(e => id.endsWith(e))) {
76+
const buffer = fs.readFileSync(id);
77+
return {
78+
code: `export default ${JSON.stringify(buffer)}`,
79+
map: null
80+
};
81+
}
82+
}
83+
};
84+
}

package-lock.json

Lines changed: 48 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "emeraldjava.github.io",
3-
"version": "2024.11.16",
3+
"version": "2024.12.21",
44
"scripts": {
55
"dev": "astro dev",
66
"start": "astro dev",
@@ -18,6 +18,7 @@
1818
"@astrojs/rss": "^4.0.7",
1919
"@giscus/react": "^3.0.0",
2020
"@resvg/resvg-js": "^2.6.2",
21+
"@vercel/og": "^0.6.4",
2122
"astro": "^4.16.3",
2223
"fuse.js": "^7.0.0",
2324
"lodash.kebabcase": "^4.1.1",

src/utils/loadGoogleFont.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,23 @@ async function loadGoogleFonts(
4545
> {
4646
const fontsConfig = [
4747
{
48-
name: "IBM Plex Mono",
49-
font: "IBM+Plex+Mono",
48+
name: "Space Mono",
49+
font: "Space+Mono",
5050
weight: 400,
5151
style: "normal",
5252
},
53-
{
54-
name: "IBM Plex Mono",
55-
font: "IBM+Plex+Mono:wght@700",
56-
weight: 700,
57-
style: "bold",
58-
},
53+
// {
54+
// name: "IBM Plex Mono",
55+
// font: "IBM+Plex+Mono",
56+
// weight: 400,
57+
// style: "normal",
58+
// },
59+
// {
60+
// name: "IBM Plex Mono",
61+
// font: "IBM+Plex+Mono:wght@700",
62+
// weight: 700,
63+
// style: "bold",
64+
// },
5965
];
6066

6167
const fonts = await Promise.all(

0 commit comments

Comments
 (0)