mirror of https://github.com/sveltejs/svelte
parent
21ac4a6ac9
commit
fd41afadfb
@ -1 +0,0 @@
|
||||
export const prerender = true;
|
||||
@ -0,0 +1,43 @@
|
||||
import { get_example } from '$lib/server/examples';
|
||||
import { get_examples_data, get_examples_list } from '$lib/server/examples/get-examples';
|
||||
|
||||
export const prerender = true;
|
||||
|
||||
const examples = [
|
||||
{
|
||||
id: 'hello-world',
|
||||
title: 'Hello World',
|
||||
description: 'Svelte components are built on top of HTML. Just add data.',
|
||||
},
|
||||
{
|
||||
id: 'nested-components',
|
||||
title: 'Scoped CSS',
|
||||
description:
|
||||
'CSS is component-scoped by default — no more style collisions or specificity wars. Or you can <a href="/blog/svelte-css-in-js">use your favourite CSS-in-JS library</a >.',
|
||||
},
|
||||
{
|
||||
id: 'reactive-assignments',
|
||||
title: 'Reactivity',
|
||||
description:
|
||||
'Trigger efficient, granular updates by assigning to local variables. The compiler does the rest.',
|
||||
},
|
||||
{
|
||||
id: 'svg-transitions',
|
||||
title: 'Transitions',
|
||||
description:
|
||||
'Build beautiful UIs with a powerful, performant transition engine built right into the framework.',
|
||||
},
|
||||
];
|
||||
|
||||
export const load = () => {
|
||||
const examples_data = get_examples_data();
|
||||
|
||||
return {
|
||||
examples: examples.map(({ description, id, title }) => ({
|
||||
id,
|
||||
title,
|
||||
description,
|
||||
files: get_example(examples_data, id).files,
|
||||
})),
|
||||
};
|
||||
};
|
||||
@ -1,7 +0,0 @@
|
||||
import { get_example } from '$lib/server/examples';
|
||||
import { get_examples_data } from '$lib/server/examples/get-examples';
|
||||
import { json } from '@sveltejs/kit';
|
||||
|
||||
export const GET = async ({ params }) => {
|
||||
return json(get_example(get_examples_data(), params.slug));
|
||||
};
|
||||
Loading…
Reference in new issue