Add svelte as a view engine to swaf #33
@ -317,6 +317,7 @@ export default class SvelteViewEngine extends ViewEngine {
|
||||
});
|
||||
|
||||
const locals = this.getGlobals();
|
||||
delete require.cache[path.resolve(file)];
|
||||
return requireFromString(svelteSsr.js.code, file).default.render({
|
||||
swaf: (key: string, args?: unknown[]) => {
|
||||
if (!args) return locals[key];
|
||||
|
@ -24,7 +24,11 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<Layout title="Home"/>
|
||||
<Layout title="Home">
|
||||
<svelte:fragment slot="body">
|
||||
<h1>BONJOUR lol</h1>
|
||||
</svelte:fragment>
|
||||
</Layout>
|
||||
|
||||
<h1>Hello {count}!</h1>
|
||||
|
||||
|
@ -4,6 +4,12 @@
|
||||
export let refresh_after = undefined;
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.body {
|
||||
border: 1px solid blue;
|
||||
}
|
||||
</style>
|
||||
|
||||
<svelte:head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
@ -21,3 +27,8 @@
|
||||
<meta http-equiv="refresh" content={refresh_after}>
|
||||
{/if}
|
||||
</svelte:head>
|
||||
|
||||
<div class="body">
|
||||
hello
|
||||
<slot name="body"/>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user