mirror of
https://github.com/zyllian/webdog.git
synced 2025-06-27 17:05:44 -07:00
add feature to set a custom path for static webdog resources
This commit is contained in:
parent
b4088fb397
commit
3daa80f8af
2 changed files with 12 additions and 3 deletions
|
@ -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"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue