What's the best way to package multiple static files?


#1

So I have an SPA webapp that uses rocket web framework and has multiple html/css/js in a directory.

#[get("/web/<file..>")]
fn webfiles(file: PathBuf) -> Option<NamedFile> {
    NamedFile::open(Path::new("./public/").join(file)).ok()
}

In my development environment, this is a NO problem because the directory is right alongside with the source code. However, how I do this if I make it an installable cargo crate. The requirement being is that, it will need to have the static files when launched in order to work correctly. Another (smaller) problem is that the the static files are just output from a different compiler chain (js, elm,minifier), however, this can be solved by creating a new repo that checked in the compiled js code and static files. I don’t want to check-in the generated code in the main repo, since it will just make unnecessary version control noises.