about summary refs log tree commit diff
path: root/src/gen.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/gen.zig')
-rw-r--r--src/gen.zig8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gen.zig b/src/gen.zig
index fdd33bf..c4d945c 100644
--- a/src/gen.zig
+++ b/src/gen.zig
@@ -94,8 +94,6 @@ fn genSite(ctx: *Context) !void {
         const rel_dstpath = try std.fs.path.relative(ctx.allocator(), Context.params.SITE_PATH, dstpath);
         defer ctx.allocator().free(rel_dstpath);
 
-        log.debug("generating {s} at {s}", .{ p, rel_dstpath });
-
         if (std.fs.path.dirname(rel_dstpath)) |d| {
             const dstdir = try fs.joinPathAndFilename(ctx.allocator(), &.{Context.params.SITE_PATH}, &.{d});
             defer ctx.allocator().free(dstdir);
@@ -103,6 +101,12 @@ fn genSite(ctx: *Context) !void {
             try std.fs.cwd().makePath(dstdir);
         }
 
+        const srcmtime = try fs.getLastEdit(srcpath);
+        const dstmtime = try fs.getLastEdit(dstpath);
+        if (srcmtime.sec < dstmtime.sec) continue;
+
+        log.debug("generating {s} at {s}", .{ p, rel_dstpath });
+
         const f = try fs.FileSwapper.createAt(ctx.allocator(), dstpath);
         defer f.close();