mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-12 11:15:14 +00:00
minify HTML at build time (also fixes #181)
This commit is contained in:
@@ -5,7 +5,6 @@ import mkdirp from 'mkdirp';
|
||||
import rimraf from 'rimraf';
|
||||
import devalue from 'devalue';
|
||||
import { lookup } from './middleware/mime';
|
||||
import { minify_html } from './middleware/minify_html';
|
||||
import { create_routes, create_compilers } from './core';
|
||||
import { locations, dev } from './config';
|
||||
import { Route, Template } from './interfaces';
|
||||
@@ -113,8 +112,8 @@ const resolved = Promise.resolve();
|
||||
|
||||
function get_route_handler(chunks: Record<string, string>, routes: RouteObject[]) {
|
||||
const template = dev()
|
||||
? () => fs.readFileSync('app/template.html', 'utf-8')
|
||||
: (str => () => str)(minify_html(fs.readFileSync('app/template.html', 'utf-8')));
|
||||
? () => fs.readFileSync(`${locations.app()}/template.html`, 'utf-8')
|
||||
: (str => () => str)(fs.readFileSync(`${locations.dest()}/template.html`, 'utf-8'));
|
||||
|
||||
function handle_route(route: RouteObject, req: Req, res: ServerResponse) {
|
||||
req.params = route.params(route.pattern.exec(req.pathname));
|
||||
|
||||
Reference in New Issue
Block a user