Hello!
Apologies, I posted this on github issues before I read the CONTRIBUTING guide and learned that feature requests should be posted here instead.
I noticed that Zola is using the minify-html crate. This crate has a config option to keep-comments
but that is not exposed by Zola. It would be nice if there were an additional config booleon in config.toml to set this and pass it through to the minify()
function call.
I see that Zola is hard coding the config that gets passed to minify()
here:
pub fn html(html: String) -> Result<String> {
let mut cfg = Cfg::spec_compliant();
cfg.keep_html_and_head_opening_tags = true;
cfg.minify_css = true;
cfg.minify_js = true;
let minified = minify(html.as_bytes(), &cfg);
match std::str::from_utf8(&minified) {
Ok(result) => Ok(result.to_string()),
Err(err) => bail!("Failed to convert bytes to string : {}", err),
}
}
I would request that this default config object be available to be overriden in config.toml like so:
minify_html = true
minify_config = { keep_comments = true }
We need this because we are using Server Side Includes, which is a standard that is used by many web servers such as Apache SSI. The problem is that these look like regular HTML comments so the minifier strips them out. So if we could use the config option to keep_comments offered by the minify-html crate then we could still minify but not break our SSI code.
The keep_comments is just one use case to allow overriding of the minify-html config. I can see other use cases where other minify-html config options could be changed.
Thanks!