mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-19 13:55:21 +00:00
minify HTML on export
This commit is contained in:
@@ -5,6 +5,7 @@ import cheerio from 'cheerio';
|
|||||||
import URL from 'url-parse';
|
import URL from 'url-parse';
|
||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import * as ports from 'port-authority';
|
import * as ports from 'port-authority';
|
||||||
|
import { minify_html } from './utils/minify_html';
|
||||||
import { locations } from '../config';
|
import { locations } from '../config';
|
||||||
|
|
||||||
export async function exporter(export_dir: string) {
|
export async function exporter(export_dir: string) {
|
||||||
@@ -47,7 +48,7 @@ export async function exporter(export_dir: string) {
|
|||||||
|
|
||||||
if (message.type === 'text/html') {
|
if (message.type === 'text/html') {
|
||||||
const file = `${export_dir}/${url.pathname}/index.html`;
|
const file = `${export_dir}/${url.pathname}/index.html`;
|
||||||
sander.writeFileSync(file, message.body);
|
sander.writeFileSync(file, minify_html(message.body));
|
||||||
} else {
|
} else {
|
||||||
const file = `${export_dir}/${url.pathname}`;
|
const file = `${export_dir}/${url.pathname}`;
|
||||||
sander.writeFileSync(file, message.body);
|
sander.writeFileSync(file, message.body);
|
||||||
|
|||||||
Reference in New Issue
Block a user