don't always minify when rendering html
Some checks are pending
ci/woodpecker/push/publish Pipeline is pending
ci/woodpecker/pr/publish Pipeline is pending

This commit is contained in:
Mylloon 2023-04-09 16:52:07 +02:00
parent 45b2de54fb
commit f368e57d7f
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -1,14 +1,5 @@
use askama::DynTemplate; use askama::DynTemplate;
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(); 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();
String::from_utf8(minify(data.as_bytes(), &cfg)).unwrap()
} }