cargo-web icon indicating copy to clipboard operation
cargo-web copied to clipboard

Static library files

Open kuviman opened this issue 5 years ago • 4 comments

It would be cool if it was possible for libraries to provide static files, not only the final app crate.

Currently it's only possible to embed files into libraries with include_bytes!/include_str!, but this is not good if the file is large.

kuviman avatar Mar 23 '19 14:03 kuviman

but this is not good if the file is large.

Why isn't it good?

Pauan avatar Mar 23 '19 19:03 Pauan

I've had some problems with loading images when they are embedded like this (which requires using image crate, and causing browser to hang, not sure why), while loading images with browser native APIs is much lighter, makes the wasm file smaller, which is useful if I'm downloading the image in background

kuviman avatar Mar 23 '19 20:03 kuviman

Ah, okay, so you're saying you want it to include the files in the directory, but keep them separate (i.e. not bundle them)?

Pauan avatar Mar 24 '19 12:03 Pauan

I want the behavior of static files, but for library crates.

So that the static folders of all the crates in the dependency tree get merged when deploying the app.

kuviman avatar Mar 24 '19 13:03 kuviman