Files
sapper/src/core/read_template.ts
Rich Harris ff24877d8f -> v0.21.1
2018-09-23 23:21:37 -04:00

17 lines
434 B
TypeScript

import * as fs from 'fs';
import { locations } from '../config';
export default function read_template(dir = locations.src()) {
try {
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:
app/ --> src/
routes/ --> src/routes/
assets/ --> static/`);
}
throw err;
}
}