Update build.sh
This commit is contained in:
77
build.sh
77
build.sh
@@ -16,7 +16,7 @@ if [ $(expr length "$args") -gt 1 ]
|
||||
then
|
||||
args=$@
|
||||
else
|
||||
args='inflate style copy'
|
||||
args='inflate style copy conv-img'
|
||||
fi
|
||||
|
||||
# Cheap patch for copying in case the paths aren't present.
|
||||
@@ -24,24 +24,34 @@ mkdir -p target
|
||||
|
||||
for x in $args
|
||||
do
|
||||
cmd=''
|
||||
|
||||
files=()
|
||||
|
||||
src_ext=''
|
||||
target_ext=''
|
||||
target_opt=''
|
||||
|
||||
if [ "$x" == 'inflate' ]
|
||||
then
|
||||
cmd='python balloon.py'
|
||||
|
||||
files=(`ls src/*.html`)
|
||||
# Because bash won't let **/ find files without another nested dir.
|
||||
files+=(`ls src/blog/*.html`) # This wouldn't be needed under zsh.
|
||||
files+=(`ls src/blog/**/*.html`)
|
||||
files+=(`ls src/errors/*.html`)
|
||||
files+=(`ls src/minecraft/*.html`)
|
||||
files+=(`ls src/minecraft/**/*.html`)
|
||||
files=(`
|
||||
find src -not\
|
||||
\(\
|
||||
\(\
|
||||
-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 "*.html"\
|
||||
-print
|
||||
`)
|
||||
|
||||
target_ext='.html'
|
||||
|
||||
action=Inflating...
|
||||
|
||||
@@ -49,11 +59,24 @@ do
|
||||
then
|
||||
cmd='sass'
|
||||
|
||||
files='src/style.scss'
|
||||
files+=(`ls src/**/style.scss`)
|
||||
files+=(`ls src/**/**/style.scss`)
|
||||
files=(`
|
||||
find src -not\
|
||||
\(\
|
||||
\(\
|
||||
-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'
|
||||
|
||||
action=Styling...
|
||||
@@ -67,14 +90,25 @@ do
|
||||
'src/feed/rss.xml'
|
||||
'src/robots.txt'
|
||||
)
|
||||
files+=(`ls src/img/`)
|
||||
|
||||
mkdir -p target/.well-known
|
||||
mkdir -p target/feed
|
||||
mkdir -p target/img
|
||||
|
||||
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' ]
|
||||
then
|
||||
echo -e "$green"Cleaning...
|
||||
@@ -102,13 +136,14 @@ do
|
||||
|
||||
for src in "${files[@]}"
|
||||
do
|
||||
target="${src//$src_prefix}"
|
||||
target="${target//$src_ext}"
|
||||
target="target/$target$target_ext"
|
||||
filename=$(basename $src)
|
||||
path="${src//$src_prefix}"
|
||||
path="${path//$filename}"
|
||||
target="target/$path${filename%.*}$target_ext"
|
||||
|
||||
echo -e "$cyan $src -> $target"
|
||||
|
||||
eval "$cmd $src $target"
|
||||
eval "$cmd $src $target_opt $target"
|
||||
done
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user