mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-12 03:05:12 +00:00
minify HTML at build time (also fixes #181)
This commit is contained in:
@@ -3,6 +3,7 @@ import * as path from 'path';
|
||||
import * as clorox from 'clorox';
|
||||
import mkdirp from 'mkdirp';
|
||||
import rimraf from 'rimraf';
|
||||
import { minify_html } from './utils/minify_html';
|
||||
import { create_compilers, create_main_manifests, create_routes, create_serviceworker_manifest } from '../core'
|
||||
import { locations } from '../config';
|
||||
|
||||
@@ -40,6 +41,11 @@ export async function build() {
|
||||
console.log(clorox.inverse(`\nbuilt service worker`).toString());
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user