Function minify_html::minify[][src]

pub fn minify(src: &[u8], cfg: &Cfg) -> Vec<u8>
Expand description

Minifies UTF-8 HTML code, represented as an array of bytes.

Arguments

  • code - A slice of bytes representing the source code to minify.
  • cfg - Configuration object to adjust minification approach.

Examples

use minify_html::{Cfg, minify};

let mut code: &[u8] = b"<p>  Hello, world!  </p>";
let mut cfg = Cfg::new();
cfg.keep_comments = true;
let minified = minify(&code, &cfg);
assert_eq!(minified, b"<p>Hello, world!".to_vec());