Crates.io | html5minify |
lib.rs | html5minify |
version | 0.3.3 |
source | src |
created_at | 2019-07-25 17:46:13.286848 |
updated_at | 2022-05-26 07:03:01.942167 |
description | HTML5 minifier implementation based on Servo's html5ever. |
homepage | https://martingallagher.com/ |
repository | https://github.com/martingallagher/html5minify.git |
max_upload_size | |
id | 151608 |
size | 35,436 |
HTML5 minifier implementation based on Servo's html5ever.
AsRef<[u8]>
/ io::Read
Vec<u8>
/ io::Write
use html5minify::Minify;
// Using Minify trait on &str:
let html = "<html> \n<link href=\"test.css\">\n<h2 id=\"id_one\" >Hello\n</h2> \n<p>\nWorld</p>";
let minified = html.minify().expect("Failed to minify HTML");
// Using minifier with omit doctype option set:
let mut minified = vec![];
Minifier::new(&mut minified)
.omit_doctype(true)
.minify(&mut html.as_bytes())
.expect("Failed to minify HTML");