update to v2

This commit is contained in:
Rich Harris
2018-04-19 11:05:29 -04:00
parent 247c3c2dbd
commit a7cb019102
11 changed files with 23 additions and 27 deletions

View File

@@ -17,7 +17,7 @@
"polka": "^0.3.4", "polka": "^0.3.4",
"sapper": "^0.10.0", "sapper": "^0.10.0",
"serve-static": "^1.13.1", "serve-static": "^1.13.1",
"svelte": "^1.57.3", "svelte": "^2.0.0",
"svelte-loader": "^2.3.3", "svelte-loader": "^2.3.3",
"webpack": "^4.1.0" "webpack": "^4.1.0"
} }

View File

@@ -1,6 +1,6 @@
<:Head> <svelte:head>
<title>Not found</title> <title>Not found</title>
</:Head> </svelte:head>
<Layout page='home'> <Layout page='home'>
<h1>Not found</h1> <h1>Not found</h1>

View File

@@ -1,6 +1,6 @@
<:Head> <svelte:head>
<title>Internal server error</title> <title>Internal server error</title>
</:Head> </svelte:head>
<Layout page='home'> <Layout page='home'>
<h1>Internal server error</h1> <h1>Internal server error</h1>

View File

@@ -1,4 +1,4 @@
<Nav page={{page}}/> <Nav page={page}/>
<main> <main>
<slot></slot> <slot></slot>

View File

@@ -1,11 +1,11 @@
<nav> <nav>
<ul> <ul>
<li><a class='{{page === "home" ? "selected" : ""}}' href='.'>home</a></li> <li><a class='{page === "home" ? "selected" : ""}' href='.'>home</a></li>
<li><a class='{{page === "about" ? "selected" : ""}}' href='about'>about</a></li> <li><a class='{page === "about" ? "selected" : ""}' href='about'>about</a></li>
<!-- for the blog link, we're using rel=prefetch so that Sapper prefetches <!-- for the blog link, we're using rel=prefetch so that Sapper prefetches
the blog data when we hover over the link or tap it on a touchscreen --> the blog data when we hover over the link or tap it on a touchscreen -->
<li><a rel=prefetch class='{{page === "blog" ? "selected" : ""}}' href='blog'>blog</a></li> <li><a rel=prefetch class='{page === "blog" ? "selected" : ""}' href='blog'>blog</a></li>
</ul> </ul>
</nav> </nav>

View File

@@ -1,6 +1,6 @@
<:Head> <svelte:head>
<title>About</title> <title>About</title>
</:Head> </svelte:head>
<Layout page='about'> <Layout page='about'>
<h1>About this site</h1> <h1>About this site</h1>

View File

@@ -1,12 +1,12 @@
<:Head> <svelte:head>
<title>{{post.title}}</title> <title>{post.title}</title>
</:Head> </svelte:head>
<Layout page='blog'> <Layout page='blog'>
<h1>{{post.title}}</h1> <h1>{post.title}</h1>
<div class='content'> <div class='content'>
{{{post.html}}} {@html post.html}
</div> </div>
</Layout> </Layout>

View File

@@ -1,18 +1,18 @@
<:Head> <svelte:head>
<title>Blog</title> <title>Blog</title>
</:Head> </svelte:head>
<Layout page='blog'> <Layout page='blog'>
<h1>Recent posts</h1> <h1>Recent posts</h1>
<ul> <ul>
{{#each posts as post}} {#each posts as post}
<!-- we're using the non-standard `rel=prefetch` attribute to <!-- we're using the non-standard `rel=prefetch` attribute to
tell Sapper to load the data for the page as soon as tell Sapper to load the data for the page as soon as
the user hovers over the link or taps it, instead of the user hovers over the link or taps it, instead of
waiting for the 'click' event --> waiting for the 'click' event -->
<li><a rel='prefetch' href='blog/{{post.slug}}'>{{post.title}}</a></li> <li><a rel='prefetch' href='blog/{post.slug}'>{post.title}</a></li>
{{/each}} {/each}
</ul> </ul>
</Layout> </Layout>

View File

@@ -1,6 +1,6 @@
<:Head> <svelte:head>
<title>Sapper project template</title> <title>Sapper project template</title>
</:Head> </svelte:head>
<Layout page='home'> <Layout page='home'>
<h1>Great success!</h1> <h1>Great success!</h1>

View File

@@ -19,8 +19,6 @@ module.exports = {
loader: 'svelte-loader', loader: 'svelte-loader',
options: { options: {
hydratable: true, hydratable: true,
cascade: false,
store: true,
hotReload: true hotReload: true
} }
} }

View File

@@ -18,8 +18,6 @@ module.exports = {
loader: 'svelte-loader', loader: 'svelte-loader',
options: { options: {
css: false, css: false,
cascade: false,
store: true,
generate: 'ssr' generate: 'ssr'
} }
} }