rocket-static-files
Serves static files with far-future cache headers, and version specific URLs.
Usage
Dependencies
Add the following dependencies:
[]
= "0.1"
[]
= { = "0.1", = [ "gen" ] }
Build Script
To generate the hashes, add the following to your build.rs
(this assumes your static files are located at $CARGO_MANIFEST_DIR/static
):
use PathBuf;
Fairing
use StaticFiles;
include!;
Rocket.toml
Add a section like this:
[]
= "./static" # Relative to Rocket.toml
= "/static" # Where to serve the files: http://127.0.0.1:8000/static