Skip to content

Commit ef98a8d

Browse files
committed
feat: add generation time
1 parent 8408a2e commit ef98a8d

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/generate.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::index_page::generate_index_page;
99
use crate::render_page::render_page;
1010
use crate::template_processors::process_template_tags;
1111
use std::collections::HashMap;
12-
use std::time::{SystemTime, UNIX_EPOCH};
12+
use std::time::{SystemTime, UNIX_EPOCH, Instant};
1313

1414
fn prepare_page_context<'a>(
1515
item: &'a HashMap<String, String>,
@@ -107,6 +107,9 @@ fn generate_pages(
107107
}
108108

109109
pub fn generate(site_name: &str) -> Result<()> {
110+
// Start timing the generation process
111+
let start_time = Instant::now();
112+
110113
// Get the current system time
111114
let now = SystemTime::now();
112115
let duration_since_epoch = now.duration_since(UNIX_EPOCH).expect("Time went backwards");
@@ -157,6 +160,10 @@ pub fn generate(site_name: &str) -> Result<()> {
157160
&mut global_variables,
158161
)?;
159162

163+
// Log the total generation time
164+
let elapsed = start_time.elapsed();
165+
println!("✓ Generated site '{}' in {}ms", site_name, elapsed.as_millis());
166+
160167
Ok(())
161168
}
162169

src/template_processors/liquid/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,3 @@ mod include;
99

1010
pub use _if::process_liquid_conditional_tags;
1111
pub use processor::process_liquid_tags;
12-
pub use include::process_liquid_includes;
13-
14-
// Re-export commonly used types
15-
pub use std::collections::HashMap;

src/template_processors/markdown/markdown.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#[cfg(test)]
12
pub fn double_line_breaks_to_html(input: &str) -> String {
23
input
34
.split("\n\n")

0 commit comments

Comments
 (0)