mirror of https://github.com/sveltejs/svelte
chore: various playground fixes (#12291)
parent
2f1d2d5906
commit
eb3e677e05
@ -1,8 +0,0 @@
|
||||
<script lang="ts">
|
||||
function openInEditor() {
|
||||
fetch('./__open-in-editor?file=src/App.svelte');
|
||||
}
|
||||
</script>
|
||||
|
||||
<h1>Demo App</h1>
|
||||
<button class="open-in-editor" on:click={openInEditor}>edit App.svelte</button>
|
@ -1,6 +1,13 @@
|
||||
import fs from 'node:fs';
|
||||
const destination = new URL('../src/App.svelte', import.meta.url);
|
||||
|
||||
const destination = new URL('../src/main.svelte', import.meta.url);
|
||||
|
||||
if (!fs.existsSync(destination)) {
|
||||
const template = new URL('./App.template.svelte', import.meta.url);
|
||||
const template = new URL('./main.template.svelte', import.meta.url);
|
||||
|
||||
try {
|
||||
fs.mkdirSync(new URL('../src', import.meta.url));
|
||||
} catch {}
|
||||
|
||||
fs.writeFileSync(destination, fs.readFileSync(template, 'utf-8'), 'utf-8');
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
<script lang="ts">
|
||||
function openInEditor() {
|
||||
fetch('./__open-in-editor?file=src/main.svelte');
|
||||
}
|
||||
</script>
|
||||
|
||||
<h1>Demo App</h1>
|
||||
<button class="open-in-editor" on:click={openInEditor}>edit main.svelte</button>
|
@ -1,5 +0,0 @@
|
||||
import { render } from 'svelte/server';
|
||||
// @ts-ignore you need to create this file
|
||||
import App from './App.svelte';
|
||||
|
||||
export const { head, body } = render(App);
|
Loading…
Reference in new issue