Browse Source

Generate assets before rendering templates

index-subcmd
Vincent Prouillet 5 years ago
parent
commit
3b8a95eb8f
1 changed files with 20 additions and 18 deletions
  1. +20
    -18
      components/site/src/lib.rs

+ 20
- 18
components/site/src/lib.rs View File

@@ -536,6 +536,26 @@ impl Site {
/// Deletes the `public` directory and builds the site /// Deletes the `public` directory and builds the site
pub fn build(&self) -> Result<()> { pub fn build(&self) -> Result<()> {
self.clean()?; self.clean()?;

// Generate/move all assets before rendering any content
if let Some(ref theme) = self.config.theme {
let theme_path = self.base_path.join("themes").join(theme);
if theme_path.join("sass").exists() {
self.compile_sass(&theme_path)?;
}
}

if self.config.compile_sass {
self.compile_sass(&self.base_path)?;
}

self.process_images()?;
self.copy_static_directories()?;

if self.config.build_search_index {
self.build_search_index()?;
}

// Render aliases first to allow overwriting // Render aliases first to allow overwriting
self.render_aliases()?; self.render_aliases()?;
self.render_sections()?; self.render_sections()?;
@@ -570,24 +590,6 @@ impl Site {
self.render_robots()?; self.render_robots()?;
self.render_taxonomies()?; self.render_taxonomies()?;


if let Some(ref theme) = self.config.theme {
let theme_path = self.base_path.join("themes").join(theme);
if theme_path.join("sass").exists() {
self.compile_sass(&theme_path)?;
}
}

if self.config.compile_sass {
self.compile_sass(&self.base_path)?;
}

self.process_images()?;
self.copy_static_directories()?;

if self.config.build_search_index {
self.build_search_index()?;
}

Ok(()) Ok(())
} }




Loading…
Cancel
Save