diff --git a/src/builder.rs b/src/builder.rs index 5f4540f..d08a916 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -12,8 +12,8 @@ use url::Url; use crate::{resource::ResourceBuilder, util, PageMetadata, Site, ROOT_PATH, SASS_PATH}; -/// Path for static webdog resources included with the site build. -const WEBDOG_PATH: &str = "webdog"; +/// Default path for static webdog resources included with the site build. +const WEBDOG_DEFAULT_PATH: &str = "webdog"; /// Struct containing data to be sent to templates when rendering them. #[derive(Debug, Serialize)] @@ -96,7 +96,13 @@ impl SiteBuilder { std::fs::create_dir(&self.build_path).wrap_err("Failed to create build directory")?; } - let webdog_path = self.build_path.join(WEBDOG_PATH); + let webdog_path = self.build_path.join( + self.site + .config + .webdog_path + .clone() + .unwrap_or_else(|| WEBDOG_DEFAULT_PATH.to_string()), + ); std::fs::create_dir(&webdog_path)?; std::fs::write( webdog_path.join("webdog.js"), diff --git a/src/lib.rs b/src/lib.rs index 27f0591..5037168 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -49,6 +49,8 @@ pub struct SiteConfig { pub sass_styles: Vec, /// URL to the CDN used for the site's images. pub cdn_url: Url, + /// The path to output webdog static resources to. Defaults to "webdog" + pub webdog_path: Option, /// The theme to use for the site's code blocks. /// TODO: dark/light themes /// TODO: export themes as CSS instead of styling HTML directly @@ -73,6 +75,7 @@ impl SiteConfig { build: None, sass_styles: vec!["index.scss".into()], cdn_url, + webdog_path: None, code_theme: "base16-ocean.dark".to_string(), resources: Default::default(), }