minify HTML on export

This commit is contained in:
Rich Harris
2018-03-11 14:57:10 -04:00
parent e1b5e336dc
commit 866286c95e

View File

@@ -5,6 +5,7 @@ import cheerio from 'cheerio';
import URL from 'url-parse';
import fetch from 'node-fetch';
import * as ports from 'port-authority';
import { minify_html } from './utils/minify_html';
import { locations } from '../config';
export async function exporter(export_dir: string) {
@@ -47,7 +48,7 @@ export async function exporter(export_dir: string) {
if (message.type === 'text/html') {
const file = `${export_dir}/${url.pathname}/index.html`;
sander.writeFileSync(file, message.body);
sander.writeFileSync(file, minify_html(message.body));
} else {
const file = `${export_dir}/${url.pathname}`;
sander.writeFileSync(file, message.body);