Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
-> v0.21.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Sep 24, 2018
1 parent 9cf90ce commit ff24877
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# sapper changelog

## 0.21.1

* Read template from build directory in production

## 0.21.0

* Change project folder structure ([#432](https://github.com/sveltejs/sapper/issues/432))
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sapper",
"version": "0.21.0",
"version": "0.21.1",
"description": "Military-grade apps, engineered by Svelte",
"main": "dist/middleware.js",
"bin": {
Expand Down
4 changes: 2 additions & 2 deletions src/core/read_template.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as fs from 'fs';
import { locations } from '../config';

export default function read_template() {
export default function read_template(dir = locations.src()) {
try {
return fs.readFileSync(`${locations.src()}/template.html`, 'utf-8');
return fs.readFileSync(`${dir}/template.html`, 'utf-8');
} catch (err) {
if (fs.existsSync(`app/template.html`)) {
throw new Error(`As of Sapper 0.21, the default folder structure has been changed:
Expand Down
2 changes: 1 addition & 1 deletion src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ function get_page_handler(

const template = dev()
? () => read_template()
: (str => () => str)(read_template());
: (str => () => str)(read_template(output));

const { server_routes, pages } = manifest;
const error_route = manifest.error;
Expand Down

0 comments on commit ff24877

Please sign in to comment.