mirror of
https://git.ari.lt/ari.lt/ari.lt.git
synced 2025-02-04 09:39:25 +01:00
19 lines
548 B
Bash
Executable file
19 lines
548 B
Bash
Executable file
#!/usr/bin/env sh
|
|
|
|
set -e
|
|
|
|
main() {
|
|
if [ "$CI" ]; then
|
|
echo 'Minifying all HTML'
|
|
|
|
find . -not -ipath "./node_modules/*" -type d -exec sh -c 'find {} -maxdepth 0 -name ".minexclude"' \; -prune -o -type f -name "*.html" \
|
|
-exec html-minifier --collapse-whitespace -o {}.min {} \; \
|
|
-exec rm {} \; \
|
|
-exec mv {}.min {} \; \
|
|
-exec sh -c "printf '\n\n%s\n' '<!-- source code @ /git -->' >>\"\$1\"" -- {} \;
|
|
else
|
|
echo 'Not minifying HTML in non-CI mode'
|
|
fi
|
|
}
|
|
|
|
main "$@"
|