use %sapper.scripts%

This commit is contained in:
Rich Harris
2018-01-14 10:45:21 -05:00
parent cfeeafded4
commit c4b4bd587d
5 changed files with 4406 additions and 5 deletions

View File

@@ -149,7 +149,7 @@ function get_route_handler(fn) {
});
return templates.stream(res, 200, {
main: client.main_file,
scripts: `<script src='${client.main_file}'></script>`,
html: promise.then(rendered => rendered.html),
head: promise.then(({ head }) => `<noscript id='sapper-head-start'></noscript>${head}<noscript id='sapper-head-end'></noscript>`),
styles: promise.then(({ css }) => (css && css.code ? `<style>${css.code}</style>` : ''))
@@ -158,7 +158,7 @@ function get_route_handler(fn) {
const { html, head, css } = mod.render(data);
const page = templates.render(200, {
main: client.main_file,
scripts: `<script src='${client.main_file}'></script>`,
html,
head: `<noscript id='sapper-head-start'></noscript>${head}<noscript id='sapper-head-end'></noscript>`,
styles: (css && css.code ? `<style>${css.code}</style>` : '')
@@ -221,7 +221,7 @@ function get_not_found_handler(fn) {
title: 'Not found',
status: 404,
method: req.method,
main: asset_cache.client.main_file,
scripts: `<script src='${asset_cache.client.main_file}'></script>`,
url: req.url
}));
};