mirror of
https://github.com/zyllian/webdog.git
synced 2025-05-10 02:26:42 -07:00
Copy files to root on initial build
This commit is contained in:
parent
311a6b40d5
commit
ef470c7fdd
3 changed files with 12 additions and 1 deletions
1
site/root/CNAME
Normal file
1
site/root/CNAME
Normal file
|
@ -0,0 +1 @@
|
||||||
|
zoey.dev
|
|
@ -11,7 +11,7 @@ use pulldown_cmark::{Options, Parser};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use walkdir::WalkDir;
|
use walkdir::WalkDir;
|
||||||
|
|
||||||
use crate::{util, PageMetadata, Site, SASS_PATH, STATIC_PATH};
|
use crate::{util, PageMetadata, Site, ROOT_PATH, SASS_PATH, STATIC_PATH};
|
||||||
|
|
||||||
/// Struct containing data to be sent to templates when rendering them.
|
/// Struct containing data to be sent to templates when rendering them.
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
|
@ -83,6 +83,15 @@ impl<'a> SiteBuilder<'a> {
|
||||||
.context("Failed to register template file")?;
|
.context("Failed to register template file")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let root_path = self.site.site_path.join(ROOT_PATH);
|
||||||
|
if root_path.exists() {
|
||||||
|
for entry in root_path.read_dir()? {
|
||||||
|
let entry = entry?;
|
||||||
|
let path = entry.path();
|
||||||
|
std::fs::copy(&path, self.build_path.join(path.strip_prefix(&root_path)?))?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let static_path = self.site.site_path.join(STATIC_PATH);
|
let static_path = self.site.site_path.join(STATIC_PATH);
|
||||||
if static_path.exists() {
|
if static_path.exists() {
|
||||||
fs_extra::copy_items(
|
fs_extra::copy_items(
|
||||||
|
|
|
@ -18,6 +18,7 @@ const PAGES_PATH: &str = "pages";
|
||||||
const TEMPLATES_PATH: &str = "templates";
|
const TEMPLATES_PATH: &str = "templates";
|
||||||
const STATIC_PATH: &str = "static";
|
const STATIC_PATH: &str = "static";
|
||||||
const SASS_PATH: &str = "sass";
|
const SASS_PATH: &str = "sass";
|
||||||
|
const ROOT_PATH: &str = "root";
|
||||||
|
|
||||||
/// Struct for the site's configuration.
|
/// Struct for the site's configuration.
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue