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.