ferron

Ferron is a fast and simple static website generator made with Lua.
Log | Files | Refs | Submodules | README | LICENSE

commit 5d0ea02789da26c748cb75d9d74cf2042fba63c2
parent bb83337f202a044c303ff6d26a9f5bdc0581f95b
Author: Hugo Soucy <hugo@soucy.cc>
Date:   Sat, 25 Apr 2020 22:13:13 -0400

Render a page only if it's modified from the last site build

Diffstat:
Mferron/page.lua | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/ferron/page.lua b/ferron/page.lua @@ -155,7 +155,12 @@ function page.makepages(sitedata) -- Render single pages tb.each( function(p) - if lfs.attributes(p).modification > lfs.attributes(lfs.currentdir() .. '/lastbuild').modification then + local lastbuild = lfs.attributes(lfs.currentdir() .. '/lastbuild').modification + local pagemod = lfs.attributes(p).modification + local pageconfmod = (lfs.attributes(fl.removeextension(p) .. '.json') + or lfs.attributes(fl.removeextension(p) .. '.lua')).modification + + if pagemod > lastbuild or pageconfmod > lastbuild then print(p) page.render(p, sitedata) end