2022-03-09 01:21:31 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
2022-03-20 07:08:32 -07:00
|
|
|
# compress static assets
|
2022-03-09 01:21:31 -08:00
|
|
|
|
2022-03-20 07:08:32 -07:00
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
cd web/ui
|
|
|
|
cp embed.go.tmpl embed.go
|
2022-09-06 05:24:06 -07:00
|
|
|
|
|
|
|
GZIP_OPTS="-fk"
|
|
|
|
# gzip option '-k' may not always exist in the latest gzip available on different distros.
|
|
|
|
if ! gzip -k -h &>/dev/null; then GZIP_OPTS="-f"; fi
|
|
|
|
|
2022-03-20 07:08:32 -07:00
|
|
|
find static -type f -name '*.gz' -delete
|
2024-01-02 03:00:42 -08:00
|
|
|
find static -type f -exec gzip $GZIP_OPTS '{}' \; -print0 | xargs -0 -I % echo %.gz | sort | xargs echo //go:embed >> embed.go
|
2022-03-20 07:08:32 -07:00
|
|
|
echo var EmbedFS embed.FS >> embed.go
|