mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-20 14:25:07 +00:00
expect %sapper.base%
This commit is contained in:
@@ -13,6 +13,18 @@ export async function build() {
|
|||||||
mkdirp.sync(output);
|
mkdirp.sync(output);
|
||||||
rimraf.sync(path.join(output, '**/*'));
|
rimraf.sync(path.join(output, '**/*'));
|
||||||
|
|
||||||
|
// minify app/template.html
|
||||||
|
// TODO compile this to a function? could be quicker than str.replace(...).replace(...).replace(...)
|
||||||
|
const template = fs.readFileSync(`${locations.app()}/template.html`, 'utf-8');
|
||||||
|
|
||||||
|
// remove this in a future version
|
||||||
|
if (template.indexOf('%sapper.base%') === -1) {
|
||||||
|
console.log(`${clorox.bold.red(`> As of Sapper v0.10, your template.html file must include %sapper.base% in the <head>`)}`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.writeFileSync(`${output}/template.html`, minify_html(template));
|
||||||
|
|
||||||
const routes = create_routes();
|
const routes = create_routes();
|
||||||
|
|
||||||
// create app/manifest/client.js and app/manifest/server.js
|
// create app/manifest/client.js and app/manifest/server.js
|
||||||
@@ -41,11 +53,6 @@ export async function build() {
|
|||||||
console.log(`${clorox.inverse(`\nbuilt service worker`)}`);
|
console.log(`${clorox.inverse(`\nbuilt service worker`)}`);
|
||||||
console.log(serviceworker_stats.toString({ colors: true }));
|
console.log(serviceworker_stats.toString({ colors: true }));
|
||||||
}
|
}
|
||||||
|
|
||||||
// minify app/template.html
|
|
||||||
// TODO compile this to a function? could be quicker than str.replace(...).replace(...).replace(...)
|
|
||||||
const template = fs.readFileSync(`${locations.app()}/template.html`, 'utf-8');
|
|
||||||
fs.writeFileSync(`${output}/template.html`, minify_html(template));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function compile(compiler: any) {
|
function compile(compiler: any) {
|
||||||
|
|||||||
@@ -71,6 +71,13 @@ function create_hot_update_server(port: number, interval = 10000) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function dev(opts: { port: number, open: boolean }) {
|
export async function dev(opts: { port: number, open: boolean }) {
|
||||||
|
// remove this in a future version
|
||||||
|
const template = fs.readFileSync(path.join(locations.app(), 'template.html'), 'utf-8');
|
||||||
|
if (template.indexOf('%sapper.base%') === -1) {
|
||||||
|
console.log(`${clorox.bold.red(`> As of Sapper v0.10, your template.html file must include %sapper.base% in the <head>`)}`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
process.env.NODE_ENV = 'development';
|
process.env.NODE_ENV = 'development';
|
||||||
|
|
||||||
let port = opts.port || +process.env.PORT;
|
let port = opts.port || +process.env.PORT;
|
||||||
|
|||||||
Reference in New Issue
Block a user