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