macro_rules! fs_embed {
($($tokens:tt)*) => { ... };
}Expand description
A rust_embed asset source that embeds files in release builds. Dev builds
read from the checkout at runtime unless the debug-embed feature is enabled,
in which case they embed the files too.
It expands to one of these arms:
- Release (
not(debug_assertions)):#[derive(RustEmbed)]embeddingcrate_relativeat build time, with the giveninclude/excludeglobs. - Dev with
debug-embed: the same compile-time embedding as release. - Dev without
debug-embed: a runtime filesystem source rooted atroot_relative; edits appear on the next launch without a rebuild.
Two paths are required because the arms resolve from different bases: the
derive reads crate_relative relative to the crate’s Cargo.toml, while the
runtime dev arm resolves root_relative relative to the repository root via
dev_repo_root. Baking the build-time path into that arm would point at the
wrong checkout from another worktree and is rejected by corgi, whose sandbox
requires checkout-independent output.
ⓘ
util::fs_embed! {
pub struct Assets,
crate_relative = "../../assets",
root_relative = "assets",
include = ["fonts/**/*", "themes/**/*", "*.md"],
exclude = ["themes/src/*", "*.DS_Store"],
}