This commit is contained in:
Mylloon 2023-02-09 11:42:51 +01:00
parent b33c98958d
commit 6f3beb6368
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -4,6 +4,11 @@ use minify_html::{minify, Cfg};
pub fn render_html(template: &dyn DynTemplate) -> String { pub fn render_html(template: &dyn DynTemplate) -> String {
let data = template.dyn_render().unwrap(); let data = template.dyn_render().unwrap();
// we just minify before sending to the client,
// we need to find a way to pre-minify static pages to the dist folder,
// maybe in release mode? to make debugging easier
// from https://git.mylloon.fr/Anri/mylloon.fr/issues/15
let cfg = Cfg::spec_compliant(); let cfg = Cfg::spec_compliant();
String::from_utf8(minify(data.as_bytes(), &cfg)).unwrap() String::from_utf8(minify(data.as_bytes(), &cfg)).unwrap()
} }