Include Static Resources for Rocket Framework

Build Status

This is a crate which provides macros static_resources_initialize! and static_response! to statically include files from your Rust project and make them be the HTTP response sources quickly.

Example

```rust

![feature(plugin)]

![plugin(rocket_codegen)]

[macrouse] extern crate lazystatic;

[macrouse] extern crate lazystatic_include;

[macrouse] extern crate rocketincludestaticresources;

extern crate rocket;

staticresourcesinitialize!( "favicon", "examples/front-end/images/favicon.ico", "favicon-png", "examples/front-end/images/favicon-16.png" );

use rocketincludestatic_resources::{EtagIfNoneMatch, StaticResponse};

[get("/favicon.ico")]

fn favicon(etagifnonematch: EtagIfNoneMatch) -> StaticResponse { staticresponse!(etagifnone_match, "favicon") }

[get("/favicon.png")]

fn faviconpng() -> StaticResponse { staticresponse!("favicon-png") } ```

In order to reduce the compilation time, files are compiled into your executable binary file together, only when you are using the release profile.

See examples.

Crates.io

https://crates.io/crates/rocket-include-static-resources

Documentation

https://docs.rs/rocket-include-static-resources

License

MIT