CSS Minifier Rust Example
Check the example on how to use
Rust
to minify a CSS 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/cssminifier/api/raw") .form(&[("input", "p { color : red; }")]) .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:
p{color:red}