SSR scripts for custom components into app HTML

This commit is contained in:
Andrew Kingston 2022-08-11 15:28:59 +01:00
parent 66ab9dcc8b
commit 184936217c
2 changed files with 9 additions and 3 deletions

View File

@ -113,6 +113,7 @@ export const serveApp = async function (ctx: any) {
production: env.isProd(), production: env.isProd(),
appId, appId,
clientLibPath: clientLibraryPath(appId, appInfo.version, ctx), clientLibPath: clientLibraryPath(appId, appInfo.version, ctx),
usedPlugins: appInfo.usedPlugins,
}) })
const appHbs = loadHandlebarsFile(`${__dirname}/templates/app.hbs`) const appHbs = loadHandlebarsFile(`${__dirname}/templates/app.hbs`)

View File

@ -3,6 +3,7 @@
export let favicon = "" export let favicon = ""
export let clientLibPath export let clientLibPath
export let usedPlugins
</script> </script>
<svelte:head> <svelte:head>
@ -85,9 +86,13 @@
</script> </script>
<!-- Custom components need inserted after the core client library --> <!-- Custom components need inserted after the core client library -->
<!-- But before loadBudibase is called --> <!-- But before loadBudibase is called -->
{#if usedPlugins?.length}
{#each usedPlugins as plugin}
<script <script
type="application/javascript" type="application/javascript"
src="https://cdn.kingston.dev/plugin.min.js"></script> src={`/plugins/${plugin.jsUrl}`}></script>
{/each}
{/if}
<script type="application/javascript"> <script type="application/javascript">
if (window.loadBudibase) { if (window.loadBudibase) {
window.loadBudibase() window.loadBudibase()