1 unstable release
0.1.0 | Feb 29, 2024 |
---|
#3 in #ryde
3KB
Static files
Static files provides an easy way to declare and embed your static files.
Declare your static files
This will embed the static files in your binary at compile time with include_bytes!
.
It will try to find the files starting from the root of your project: CARGO_MANIFEST_DIR
.
use ryde::*;
#[main]
async fn main() {
serve!("localhost:3000", Routes)
}
#[router]
enum Routes {
#[embed("/static/*file")]
StaticFiles
}
Render them
fn render() -> String {
ryde::render((
doctype(),
html((
head(render!(StaticFiles)),
body(),
)),
))
}
Dependencies
~1.5MB
~38K SLoC