mirror of
https://github.com/bartvdbraak/hellob.art.git
synced 2025-06-28 07:19:09 +00:00
feat: added svelte component render for og-images
This commit is contained in:
parent
1be9ad4668
commit
3bb7737625
10 changed files with 239 additions and 236 deletions
|
@ -1,9 +1,10 @@
|
|||
import { sveltekit } from '@sveltejs/kit/vite';
|
||||
import { enhancedImages } from '@sveltejs/enhanced-img';
|
||||
import { defineConfig } from 'vite';
|
||||
import fs from 'fs';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [enhancedImages(), sveltekit()],
|
||||
plugins: [enhancedImages(), sveltekit(), rawFonts(['.woff'])],
|
||||
ssr: {
|
||||
noExternal: ['three']
|
||||
},
|
||||
|
@ -11,3 +12,15 @@ export default defineConfig({
|
|||
'import.meta.env.VERCEL_ANALYTICS_ID': JSON.stringify(process.env.VERCEL_ANALYTICS_ID)
|
||||
}
|
||||
});
|
||||
|
||||
function rawFonts(ext: string[]) {
|
||||
return {
|
||||
name: 'vite-plugin-raw-fonts',
|
||||
transform(_code: string, id: string) {
|
||||
if (ext.some((e) => id.endsWith(e))) {
|
||||
const buffer = fs.readFileSync(id);
|
||||
return { code: `export default ${JSON.stringify(buffer)}`, map: null };
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue