오윤석

svelte spa router 추가

...@@ -18,5 +18,6 @@ ...@@ -18,5 +18,6 @@
18 "dependencies": { 18 "dependencies": {
19 "rollup-plugin-copy": "^3.3.0", 19 "rollup-plugin-copy": "^3.3.0",
20 "sirv-cli": "^0.4.4", 20 "sirv-cli": "^0.4.4",
21 + "svelte-spa-router": "^2.1.0"
21 } 22 }
22 } 23 }
......
1 <script> 1 <script>
2 - export let name; 2 + import Router from 'svelte-spa-router';
3 + import routes from './routes';
3 </script> 4 </script>
4 5
5 -<main>
6 - <h1>Hello {name}!</h1>
7 - <p>Visit the <a href="https://svelte.dev/tutorial">Svelte tutorial</a> to learn how to build Svelte apps.</p>
8 -</main>
9 -
10 -<style>
11 - main {
12 - text-align: center;
13 - padding: 1em;
14 - max-width: 240px;
15 - margin: 0 auto;
16 - }
17 -
18 - h1 {
19 - color: #ff3e00;
20 - text-transform: uppercase;
21 - font-size: 4em;
22 - font-weight: 100;
23 - }
24 -
25 - @media (min-width: 640px) {
26 - main {
27 - max-width: none;
28 - }
29 - }
30 -</style>
...\ No newline at end of file ...\ No newline at end of file
6 +<Router {routes} />
...\ No newline at end of file ...\ No newline at end of file
......
1 +import Home from './routes/Home.svelte';
2 +
3 +const routes = {
4 + '/': Home,
5 +};
6 +
7 +export default routes;
...\ No newline at end of file ...\ No newline at end of file
1 +<main>
2 + <h1>Hello, This is Home!</h1>
3 + <p>Visit the <a href="https://svelte.dev/tutorial">Svelte tutorial</a> to learn how to build Svelte apps.</p>
4 +</main>
5 +
6 +<style>
7 + main {
8 + text-align: center;
9 + padding: 1em;
10 + max-width: 240px;
11 + margin: 0 auto;
12 + }
13 +
14 + h1 {
15 + color: #ff3e00;
16 + text-transform: uppercase;
17 + font-size: 4em;
18 + font-weight: 100;
19 + }
20 +
21 + @media (min-width: 640px) {
22 + main {
23 + max-width: none;
24 + }
25 + }
26 +</style>
...\ No newline at end of file ...\ No newline at end of file