Update build.sh

This commit is contained in:
Cutieguwu
2025-08-09 16:11:51 -04:00
parent 33b879d2f9
commit 4fdaeadf1c

View File

@@ -16,7 +16,7 @@ if [ $(expr length "$args") -gt 1 ]
then then
args=$@ args=$@
else else
args='inflate style copy' args='inflate style copy conv-img'
fi fi
# Cheap patch for copying in case the paths aren't present. # Cheap patch for copying in case the paths aren't present.
@@ -24,24 +24,34 @@ mkdir -p target
for x in $args for x in $args
do do
cmd=''
files=() files=()
src_ext=''
target_ext='' target_ext=''
target_opt=''
if [ "$x" == 'inflate' ] if [ "$x" == 'inflate' ]
then then
cmd='python balloon.py' cmd='python balloon.py'
files=(`ls src/*.html`) files=(`
# Because bash won't let **/ find files without another nested dir. find src -not\
files+=(`ls src/blog/*.html`) # This wouldn't be needed under zsh. \(\
files+=(`ls src/blog/**/*.html`) \(\
files+=(`ls src/errors/*.html`) -path "src/.well-known/*" -o\
files+=(`ls src/minecraft/*.html`) -path "src/feed/*" -o\
files+=(`ls src/minecraft/**/*.html`) -path "src/img/*" -o\
-path "src/includes/*" -o\
-path "src/partials/*" -o\
-path "src/templates/*"\
\)\
-prune \)\
-a\
-type f\
-name "*.html"\
-print
`)
target_ext='.html'
action=Inflating... action=Inflating...
@@ -49,11 +59,24 @@ do
then then
cmd='sass' cmd='sass'
files='src/style.scss' files=(`
files+=(`ls src/**/style.scss`) find src -not\
files+=(`ls src/**/**/style.scss`) \(\
\(\
-path "src/.well-known/*" -o\
-path "src/feed/*" -o\
-path "src/img/*" -o\
-path "src/includes/*" -o\
-path "src/partials/*" -o\
-path "src/templates/*"\
\)\
-prune \)\
-a\
-type f\
-name "*.scss"\
-print
`)
src_ext='.scss'
target_ext='.css' target_ext='.css'
action=Styling... action=Styling...
@@ -67,14 +90,25 @@ do
'src/feed/rss.xml' 'src/feed/rss.xml'
'src/robots.txt' 'src/robots.txt'
) )
files+=(`ls src/img/`)
mkdir -p target/.well-known mkdir -p target/.well-known
mkdir -p target/feed mkdir -p target/feed
mkdir -p target/img
action=Copying... action=Copying...
elif [ "$x" == 'conv-img' ]
then
cmd='cwebp -z 9 -m 6'
files=(`find src/img -type f`)
target_ext='.webp'
target_opt='-o'
mkdir -p target/img/blog/posts
action='Converting and Copying Images...'
elif [ "$x" == 'clean' ] elif [ "$x" == 'clean' ]
then then
echo -e "$green"Cleaning... echo -e "$green"Cleaning...
@@ -102,13 +136,14 @@ do
for src in "${files[@]}" for src in "${files[@]}"
do do
target="${src//$src_prefix}" filename=$(basename $src)
target="${target//$src_ext}" path="${src//$src_prefix}"
target="target/$target$target_ext" path="${path//$filename}"
target="target/$path${filename%.*}$target_ext"
echo -e "$cyan $src -> $target" echo -e "$cyan $src -> $target"
eval "$cmd $src $target" eval "$cmd $src $target_opt $target"
done done
done done