pub fn minify(
bytes: &[u8],
change_type: ChangeType,
) -> Result<Bytes, MinifyError>Expand description
Minify bytes according to change_type’s file kind.
Css is minified with lightningcss, Script with minify-js. Html and Other
pass through unchanged — this function is never called for those kinds (see
Server::with_minify), but passthrough is the correct behavior if it ever is.
§Errors
Returns Err if bytes isn’t valid UTF-8, or if the relevant minifier rejects the
input as malformed. Never panics — malformed CSS/JS on disk is a real possibility
(a hand-edited file, a build tool’s bug), not a state to unwrap through.