Closed AmateurECE closed 1 year ago
Any change that rebuilds the crate which invokes include_dir!
will cause the assets to be freshened. The easiest way to do this via the command line is to simply touch src/main.rs
(of the crate that serves the assets, not the frontend!) before cargo build
, which will rebuild only the top level crate instead of the full dependency tree. Alternatively, the branch I created for #83 is able to automatically rebuild to include modified files on stable, you can use it by adding the following snippet to your Cargo.toml
(though note that this will cause errors if I delete the branch/repo, which I will likely do when the PR is merged):
[patch.crates-io]
include_dir_macros = { git = "https://github.com/zombiepigdragon/include_dir.git", branch = "reintroduce-include-bytes" }
Using either method should be much faster than a full cargo clean && cargo build
cycle.
I'm using
include_dir
to bundle static assets for a web application I'm developing--namely, the files generated bytrunk
for my Rust WASM frontend.I've noticed that when I make a change to the frontend code and recompile, the assets built into the final binary are not updated. Doing
cargo clean && cargo build
appears to force the fresh assets to be built in, but also forces me to rebuild all of my dependencies, which takes some time.I notice there's a comment on the docs about the "nightly" feature, which suggests adding this feature might improve caching and (I suspect) may fix my issue, but my project won't compile on the nightly channel.
Is there some other way to force these assets to be freshened, even perhaps by
rm -rf
-ing some directory between builds?Thank you for your time!