pub fn minify_js(js: &str) -> StringExpand description
Minifies JavaScript by removing comments and collapsing whitespace.
ssg’s own implementation rather than a dependency. It is deliberately conservative: it does not rename, reorder or rewrite anything, so it cannot change what a script does. String, template and regex literals are copied verbatim, and the division operator is left alone.
§Examples
use ssg::plugins::minify_js;
let out = minify_js("const m = { rootMargin: \"0px 0px -15% 0px\" };");
assert_eq!(out, "const m={rootMargin:\"0px 0px -15% 0px\"};");