You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
586B

  1. use std::path::Path;
  2. use errors::Result;
  3. use site::Site;
  4. use crate::console;
  5. pub fn build(
  6. root_dir: &Path,
  7. config_file: &str,
  8. base_url: Option<&str>,
  9. output_dir: &str,
  10. include_drafts: bool,
  11. ) -> Result<()> {
  12. let mut site = Site::new(root_dir, config_file)?;
  13. site.set_output_path(output_dir);
  14. if let Some(b) = base_url {
  15. site.set_base_url(b.to_string());
  16. }
  17. if include_drafts {
  18. site.include_drafts();
  19. }
  20. site.load()?;
  21. console::notify_site_size(&site);
  22. console::warn_about_ignored_pages(&site);
  23. site.build()
  24. }