ari.lt/scripts/minhtml.sh
Ari Archer 56be07ead7 Fixed script shbangs and add an entry to usage API
Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
2022-09-28 21:30:13 +03:00

19 lines
429 B
Bash
Executable file

#!/usr/bin/env sh
set -e
main() {
if [ "$CI" ]; then
echo 'Minifying all HTML'
find . -type f -name "*.html" \
-exec html-minifier --collapse-whitespace -o {}.min {} \; \
-exec rm {} \; \
-exec mv {}.min {} \; \
-exec sh -c "echo '<!-- source code @ /git -->' >>\"\$1\"" -- {} \;
else
echo 'Not minifying HTML in non-CI mode'
fi
}
main "$@"