Skip to content

Commit

Permalink
feat(builder): render head at build-time
Browse files Browse the repository at this point in the history
  • Loading branch information
hulxv committed Aug 24, 2024
1 parent 1b1f046 commit eb0be02
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions crates/metassr-build/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use metassr_utils::{
traits::AnalyzeDir,
};
use pages_generator::PagesGenerator;
use renderer::head::HeadRenderer;

use std::{
ffi::OsStr,
Expand Down Expand Up @@ -79,7 +80,6 @@ impl Build for ServerSideBuilder {
Err(e) => return Err(anyhow!("Couldn't generate targets: {e}")),
};


if let Err(e) = WebBundler::new(
&targets.ready_for_bundling(&self.dist_path),
&self.dist_path,
Expand All @@ -93,9 +93,13 @@ impl Build for ServerSideBuilder {
sleep(Duration::from_secs(1));
let dist = DistDir::new(&self.dist_path)?.analyze()?;

ManifestGenerator::new(targets.clone(), cache_dir.clone(), dist)
.generate(&head)?
.write(&self.dist_path)?;
let manifest =
ManifestGenerator::new(targets.clone(), cache_dir.clone(), dist).generate(&head)?;
manifest.write(&self.dist_path.clone())?;

if let Err(e) = HeadRenderer::new(&manifest.global.head, cache_dir.clone()).render(true) {
return Err(anyhow!("Coludn't render head: {e}"));
}

if self.building_type == BuildingType::StaticSiteGeneration {
if let Err(e) =
Expand Down

0 comments on commit eb0be02

Please sign in to comment.