Skip to main content

is_minified

Function is_minified 

Source
pub fn is_minified(content: &str) -> bool
Expand description

Returns true if the content appears to be minified.

A file is considered minified when any of its first 5 lines exceeds 500 characters, which is characteristic of bundled or minified JavaScript/CSS.

ยงExamples

use gitprint::filter::is_minified;

assert!(is_minified(&"x".repeat(501)));   // single very long line
assert!(!is_minified("fn main() {\n    println!(\"hello\");\n}\n"));
assert!(!is_minified(""));