Support snippets.html again
This commit is contained in:
parent
199d5d9f37
commit
95b7c62f67
2 changed files with 17 additions and 1 deletions
|
@ -8,6 +8,7 @@
|
|||
<link href="/manifest.json" rel="manifest">
|
||||
<!--server-generated-meta-->
|
||||
<script type="module" src="./src/main.tsx"></script>
|
||||
<%- snippets %>
|
||||
</head>
|
||||
<body class="theme-mode-light no-reduce-motion">
|
||||
<div id="soapbox" class="h-full">
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/// <reference types="vitest" />
|
||||
import fs from 'node:fs';
|
||||
import { fileURLToPath, URL } from 'node:url';
|
||||
|
||||
import react from '@vitejs/plugin-react';
|
||||
|
@ -36,6 +37,11 @@ export default defineConfig({
|
|||
collapseWhitespace: true,
|
||||
removeComments: false,
|
||||
},
|
||||
inject: {
|
||||
data: {
|
||||
snippets: readFileContents('custom/snippets.html'),
|
||||
},
|
||||
},
|
||||
}),
|
||||
react({
|
||||
// Use React plugin in all *.jsx and *.tsx files
|
||||
|
@ -88,4 +94,13 @@ export default defineConfig({
|
|||
environment: 'jsdom',
|
||||
setupFiles: 'src/jest/test-setup.ts',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
/** Return file as string, or return empty string if the file isn't found. */
|
||||
function readFileContents(path: string) {
|
||||
try {
|
||||
return fs.readFileSync(path, 'utf8');
|
||||
} catch {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue