Crate static_web_minify

Source
Expand description

Include a minified css, js, html file as an inline const in your high-performance compiled web application. Inspired by const-css-minify

Unlinke include_str!(), you must put the name file from root of your rust project (see issue 54725).

use static_web_minify::minify_js_file;

// this is probably the pattern you want to use
const JS: &str = minify_js_file!("tests/test.js");

It’s also possible to include a raw string with:

use static_web_minify::minify_js_str;

const JS: &str = minify_js_str!(r#"
    function my_func() {
        // Great !
    }
"#);
assert_eq!(JS, "var my_func=(()=>{})");

This project has dependencies to css-minify, minify-js, html-minifier, flate2.

Macros§

gzip_file
Produce a gzip stream from file.
gzip_str
Produce a gzip stream from string.
minify_css_file
Produce a minified css from file.
minify_css_str
Produce a minified css from string.
minify_html_file
Produce a minified html from file.
minify_html_str
Produce a minified html from string.
minify_js_file
Produce a minified js from file.
minify_js_str
Produce a minified js from string.