mirror of
https://github.com/prometheus/prometheus
synced 2026-04-20 22:41:05 +08:00
ui/compress: Do not change git worktree (#10467)
This change makes sure that the git worktree is not changed while compressing assets, making it better for local development. To achieve this, the compression script keeps the un-compressed assets and generates the go:embed directory when compressing the files. A .gitignore file has been added to ignore generated files. Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# [de]compress static assets
|
||||
# compress static assets
|
||||
|
||||
find web/ui/static -type f -exec gzip "$@" {} \;
|
||||
set -euo pipefail
|
||||
|
||||
cd web/ui
|
||||
cp embed.go.tmpl embed.go
|
||||
find static -type f -name '*.gz' -delete
|
||||
find static -type f -exec gzip -fk '{}' \; -print0 | xargs -0 -I % echo %.gz | xargs echo //go:embed >> embed.go
|
||||
echo var EmbedFS embed.FS >> embed.go
|
||||
|
||||
Reference in New Issue
Block a user