You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

26 lines
608 B

#!/usr/bin/env zsh
cd "$(git rev-parse --show-toplevel)" || exit 1
webdir="_optim"
debug () {
print -- $* >/dev/null
}
type -a filelist
setopt extendedglob
if (($#>0)); then
filelist=( $* )
else
filelist=( $webdir/**/*.html(.) )
fi
tmp=$(mktemp)
for fic in $filelist; do
print -n -- "$fic "
cp $fic $tmp
perl -pi -e 's#<div id="outline-container-[^"]*"([^>]*)>#<div$1>#g;s# id="org[a-f0-9]{7}"##g;s# class="src src-# class="src-#g;s#<label class="org-src-name">#<label>#g;s#<div class="org-src-container">#<div>#g' $tmp
minify --mime text/html $tmp > $fic
print "[OK]"
done