[−][src]Function minify_html::truncate
pub fn truncate(code: &mut Vec<u8>, cfg: &Cfg) -> Result<(), Error>
Minifies a Vec in-place, truncating it to the minified length.
Arguments
code
- A slice of bytes representing the source code to minify.cfg
- Configuration object to adjust minification approach.
Examples
use minify_html::{Cfg, Error, truncate}; let mut code = b"<p> Hello, world! </p>".to_vec(); let cfg = &Cfg { minify_js: false, }; match truncate(&mut code, cfg) { Ok(()) => assert_eq!(code, b"<p>Hello, world!".to_vec()), Err(Error { error_type, position }) => {} };