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(),
appId,
clientLibPath: clientLibraryPath(appId, appInfo.version, ctx),
usedPlugins: appInfo.usedPlugins,
})
const appHbs = loadHandlebarsFile(`${__dirname}/templates/app.hbs`)

View File

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