1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Take a look at the license at the top of the repository in the LICENSE file.

mod token;

/// Minifies a given CSS source code.
///
/// # Example
///
/// ```rust
/// extern crate minifier;
/// use minifier::css::minify;
///
/// fn main() {
///     let css = r#"
///         .foo > p {
///             color: red;
///         }"#.into();
///     let css_minified = minify(css);
/// }
/// ```
pub fn minify<'a>(content: &'a str) -> Result<String, &'static str> {
    token::tokenize(content).map(|t| format!("{}", t))
}

#[cfg(test)]
mod tests;