HTML Minifier Rust Example
Check the example on how to use
Rust
to minify a HTML hardcoded string and output to stdout:use reqwest::blocking::Client;
fn main() {
let client = reqwest::blocking::Client::new();
let resp = client.post("https://www.toptal.com/developers/html-minifier/api/raw")
.form(&[("input", "<input type="text" />")])
.send().unwrap()
.text().unwrap();
println!("response = {:?}", resp);
}Install
reqwest
crate, save the code to a file named minify.rs
and run the following command:rustc minify.rs
Output:
<input>