-
Notifications
You must be signed in to change notification settings - Fork 214
[WIP] experimental new structure #57
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<Nav page={ | ||
props.path === '/' ? 'home' : | ||
props.path === '/about' ? 'about' : | ||
props.path.startsWith('/blog') ? 'blog' : | ||
null | ||
}/> | ||
|
||
<main> | ||
<svelte:component this={Page} {...props}/> | ||
</main> | ||
|
||
<style> | ||
main { | ||
position: relative; | ||
max-width: 56em; | ||
background-color: white; | ||
padding: 2em; | ||
margin: 0 auto; | ||
box-sizing: border-box; | ||
} | ||
</style> | ||
|
||
<script> | ||
import Nav from '../components/Nav.html'; | ||
|
||
export default { | ||
components: { | ||
Nav | ||
} | ||
}; | ||
</script> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import { init } from 'sapper/runtime.js'; | ||
import { routes } from './manifest/client.js'; | ||
import App from './App.html'; | ||
|
||
// `routes` is an array of route objects injected by Sapper | ||
init(document.querySelector('#sapper'), routes); | ||
|
||
if (module.hot) module.hot.accept(); | ||
init({ | ||
target: document.querySelector('#sapper'), | ||
routes, | ||
App | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,19 +6,21 @@ | |
"dev": "sapper dev", | ||
"build": "sapper build", | ||
"export": "sapper export", | ||
"start": "sapper start", | ||
"start": "node build", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this correct? shouldn't this be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's correct, yeah — as of 0.11, Sapper creates a launcher file which defaults to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This probably explains my problems w/ trying to build when upgrading Sapper. ;) Need to upgrade There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I got it all working. |
||
"cy:run": "cypress run", | ||
"cy:open": "cypress open", | ||
"test": "run-p --race dev cy:run" | ||
}, | ||
"dependencies": { | ||
"compression": "^1.7.1", | ||
"npm-run-all": "^4.1.2", | ||
"polka": "^0.3.4", | ||
"sapper": "^0.10.0", | ||
"serve-static": "^1.13.1", | ||
"sapper": "^0.12.0", | ||
"serve-static": "^1.13.1" | ||
}, | ||
"devDependencies": { | ||
"npm-run-all": "^4.1.2", | ||
"svelte": "^2.0.0", | ||
"svelte-loader": "^2.3.3", | ||
"webpack": "^4.1.0" | ||
"svelte-loader": "^2.9.0", | ||
"webpack": "^4.7.0" | ||
} | ||
} |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rich-Harris why the intensive
props.path
logic here? This seems very manifest-y, which goes against the grain of the automated path-finding you seem to support? What exactly is the function of these page props?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other words, do I have to add to this for every page I add?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can pass
props.path
down to<Nav>
instead (in fact, I prefer that — will change it)......but yes, you have to explicitly pass stuff down, just like you used to have to explicitly pass down a
page
property via the<Layout>
component in the previous template. How else will the nav bar know which option to mark as active?