integrate with the bundle command

This commit is contained in:
Evan Almloff 2023-08-18 10:27:38 -05:00
parent 213b80790b
commit 9bfe9682b5
2 changed files with 15 additions and 2 deletions

View file

@ -252,8 +252,6 @@ pub fn build(config: &CrateConfig, quiet: bool) -> Result<BuildResult> {
pub fn build_desktop(config: &CrateConfig, _is_serve: bool) -> Result<BuildResult> {
log::info!("🚅 Running build [Desktop] command...");
let _gaurd = AssetConfigDropGaurd::new();
let t_start = std::time::Instant::now();
let ignore_files = build_assets(config)?;
@ -353,6 +351,8 @@ pub fn build_desktop(config: &CrateConfig, _is_serve: bool) -> Result<BuildResul
}
}
// Collect assets
process_assets(config)?;
// Create the __assets_head.html file for bundling
create_assets_head(&config)?;

View file

@ -128,6 +128,19 @@ impl Bundle {
}
}
// Add all assets from collect assets to the bundle
{
let config = assets_cli_support::Config::current();
let location = config.assets_serve_location().to_string();
let location = format!("./{}", location);
println!("Adding assets from {} to bundle", location);
if let Some(resources) = &mut bundle_settings.resources {
resources.push(location);
} else {
bundle_settings.resources = Some(vec![location]);
}
}
let mut settings = SettingsBuilder::new()
.project_out_directory(crate_config.out_dir)
.package_settings(PackageSettings {