mettke / minify-rs

Crate for text minification. Currently supported: html, json
MIT License
1 stars 0 forks source link

minify

Minification tool for html and json

Usage

First add the library to the dependencies of your project like this:

[dependencies]
minify = "1.2"

Afterwards you can import the library like this:

extern crate minify;

Minify Html

The following rules are applied for html minification:

extern crate minify;
use minify::html::minify;

fn main() {
    let html = r#"
        <html>
            <head>
            </head>
            <body>
            </body>
        <html>
    "#;
    let html_minified = minify(html);
}

Minify JSON

The following rules are applied for json minification:

extern crate minify;
use minify::json::minify;

fn main() {
    let json = r#"
           {
               "test": "test",
               "test2": 2
           }
       "#;
    let json_minified = minify(json);
}

License: MIT