[−][src]Macro vial::bundle_assets
If you want to bundle your assets into your final binary in
release mode, then you need to call vial::bundle_assets!()
with
the path to your asset directory in a build.rs
file.
Bundling assets and setting an asset path using
vial::asset_dir!()
are mutually
exclusive - you can't do both, as enabling bundling will set the
asset path for you. Therefor if you are making the transition from
using-assets-but-not-bundling to using-assets-and-bundling-them,
make sure to remove your call to vial::asset_dir!
.
To bundle your assets, first add vial
as a build-dependency
in
your toml file:
[build-dependencies]
vial = "0.1"
Then either create or open your existing build.rs
file in the
root of your project and call vial::bundle_assets!
with the path
to your asset directory:
fn main() { vial::bundle_assets!("assets/").unwrap(); }
This will now bundle your assets in --release
mode and use the
disk in debug and test mode. All calls to functions in the
assets
module should work.