mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-19 13:55:21 +00:00
Merge branch 'issue_109-patch-1' of https://github.com/samhatchett/sapper into samhatchett-issue_109-patch-1
This commit is contained in:
@@ -149,6 +149,9 @@ function get_route_handler(get_assets, get_routes) {
|
|||||||
const mod = require(server.entry)[route.id];
|
const mod = require(server.entry)[route.id];
|
||||||
|
|
||||||
if (route.type === 'page') {
|
if (route.type === 'page') {
|
||||||
|
// for page routes, we're going to serve some HTML
|
||||||
|
res.setHeader('Content-Type', 'text/html');
|
||||||
|
|
||||||
// preload main.js and current route
|
// preload main.js and current route
|
||||||
// TODO detect other stuff we can preload? images, CSS, fonts?
|
// TODO detect other stuff we can preload? images, CSS, fonts?
|
||||||
res.setHeader('Link', `<${client.main_file}>;rel="preload";as="script", <${client.routes[route.id]}>;rel="preload";as="script"`);
|
res.setHeader('Link', `<${client.main_file}>;rel="preload";as="script", <${client.routes[route.id]}>;rel="preload";as="script"`);
|
||||||
@@ -209,9 +212,6 @@ function get_route_handler(get_assets, get_routes) {
|
|||||||
return function find_route(req, res, next) {
|
return function find_route(req, res, next) {
|
||||||
const url = req.pathname;
|
const url = req.pathname;
|
||||||
|
|
||||||
// whatever happens, we're going to serve some HTML
|
|
||||||
res.setHeader('Content-Type', 'text/html');
|
|
||||||
|
|
||||||
resolved
|
resolved
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const routes = get_routes();
|
const routes = get_routes();
|
||||||
|
|||||||
Reference in New Issue
Block a user