Function minifier::js::clean_tokens
source · [−]Expand description
Convenient function used to clean useless tokens in a token list.
Example
extern crate minifier;
use minifier::js::{clean_tokens, simple_minify};
use std::fs;
fn main() {
let content = fs::read("some_file.js").expect("file not found");
let source = String::from_utf8_lossy(&content);
let s = simple_minify(&source); // First we get the tokens list.
let s = s.apply(clean_tokens); // We now have a cleaned token list!
println!("result: {:?}", s);
}