commit 01095c36a89a4bffd6bd4b2e3ad293b594092660
parent a92137e52315b563ef11318b028b5f5aba9d2223
Author: Byron Torres <b@torresjrjr.com>
Date: Thu, 15 Jul 2021 01:32:07 +0100
Compile modified files only using .last_build
Only files modified after the last pdssg build will be processed. This
significantly reduces the time required to compile a website with
incremental modifications.
The last pdssg build time is stored as the last modified time of the
.last_build file.
Tips:
Use the `touch` command to mark files to be processed.
Run `find src | grep -v .last_time | xargs touch` to prepare a full
compilation from scratch.
Diffstat:
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/pdssg b/pdssg
@@ -41,14 +41,15 @@ prepare_dst() {
exit
}
- [ -d ./dst/ ] && {
- echo "Removing previous ./dst/ build"
- rm -r ./dst/*
- }
-
echo "Copying from ./src/ to ./dst/"
- cp -r ./src/* ./dst/
+ cp -rv $(
+ find ./src/ \
+ -newer ./src/.last_build \
+ -regex '\./src/[^.].*' \
+ -maxdepth 1
+ ) ./dst
cp ./src/_build.yml ./dst/.build.yml # builds.sr.ht
+ touch ./src/.last_build
cd ./dst/
echo :: $(pwd)