[−][src]Function minify_html::in_place
pub fn in_place(code: &mut [u8], cfg: &Cfg) -> Result<usize, Error>
Minifies a slice in-place and returns the new minified length. Any original code after the end of the minified code is left intact.
Arguments
code
- A mutable slice of bytes representing the source code to minify.cfg
- Configuration object to adjust minification approach.
Examples
use minify_html::{Cfg, Error, in_place}; let mut code = b"<p> Hello, world! </p>".to_vec(); let cfg = &Cfg { minify_js: false, }; match in_place(&mut code, cfg) { Ok(minified_len) => assert_eq!(&code, b"<p>Hello, world!d! </p>"), Err(Error { error_type, position }) => {} };