Don't process unmodified files.
This commit is contained in:
parent
c4e6adcef6
commit
9aa0727af2
1
TODO
1
TODO
@ -1,5 +1,4 @@
|
|||||||
============
|
============
|
||||||
*** TODO ***
|
*** TODO ***
|
||||||
============
|
============
|
||||||
- File date comparison to avoid unnecessary processing
|
|
||||||
- Manner to loop through files in directory
|
- Manner to loop through files in directory
|
||||||
|
26
sssg.sh
26
sssg.sh
@ -65,7 +65,6 @@ function parse {
|
|||||||
|
|
||||||
function generate {
|
function generate {
|
||||||
# create directories
|
# create directories
|
||||||
rm -rf _site
|
|
||||||
for i in $(find . -type d -not -path "./_templates" \
|
for i in $(find . -type d -not -path "./_templates" \
|
||||||
-not -path "./_site" -not -path "./_templates/*" \
|
-not -path "./_site" -not -path "./_templates/*" \
|
||||||
-not -path "./_site/*")
|
-not -path "./_site/*")
|
||||||
@ -81,18 +80,21 @@ function generate {
|
|||||||
"./_site/*")
|
"./_site/*")
|
||||||
do
|
do
|
||||||
file_path=${i:2}
|
file_path=${i:2}
|
||||||
if [ ${file_path: -4} == ".htm" ] ||
|
if [ "$file_path" -nt "_site/$file_path" ]
|
||||||
[ ${file_path: -4} == ".HTM" ] ||
|
|
||||||
[ ${file_path: -5} == ".html" ] ||
|
|
||||||
[ ${file_path: -5} == ".HTML" ]
|
|
||||||
then
|
then
|
||||||
# parse HTML/CSS files
|
if [ ${file_path: -4} == ".htm" ] ||
|
||||||
parse $file_path
|
[ ${file_path: -4} == ".HTM" ] ||
|
||||||
else
|
[ ${file_path: -5} == ".html" ] ||
|
||||||
# files that don't need parsing
|
[ ${file_path: -5} == ".HTML" ]
|
||||||
echo -n "Copying file to _site/$file_path ... "
|
then
|
||||||
cp $file_path _site/$file_path
|
# parse HTML/CSS files
|
||||||
echo "OK"
|
parse $file_path
|
||||||
|
else
|
||||||
|
# files that don't need parsing
|
||||||
|
echo -n "Copying file to _site/$file_path ... "
|
||||||
|
cp $file_path _site/$file_path
|
||||||
|
echo "OK"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user