M4-M5: index strips and Lucio branding
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
6d39dc1713
commit
45105d292f
47 files changed
+2016
-210
No files matched your search
+16
-1
@@ -17,7 +17,22 @@ case "$(uname -s)" in
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${LUPHOTO_DEV_REBUILD:-0}" = "1" ] || ! docker image inspect "$image" >/dev/null 2>&1; then
|
||||
image_present() {
|
||||
local attempt
|
||||
for attempt in 1 2 3; do
|
||||
if [ -n "$(docker images -q "$image" 2>/dev/null)" ]; then
|
||||
return 0
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
if [ "${LUPHOTO_DEV_REBUILD:-0}" = "1" ] || ! image_present; then
|
||||
if [ "$image" != "luphoto-dev" ] && [ "${LUPHOTO_DEV_REBUILD:-0}" != "1" ]; then
|
||||
echo "dev.sh: image $image not found" >&2
|
||||
exit 1
|
||||
fi
|
||||
docker build -t "$image" -f "$scripts_host/dev.Dockerfile" "$scripts_host"
|
||||
fi
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
scripts_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
repo_dir="$(dirname "$scripts_dir")"
|
||||
brand_dir="${LUCIO_IP_DIR:-$repo_dir/../LUCIO_ip}"
|
||||
out_dir="$repo_dir/web/brand"
|
||||
|
||||
for required in tokens/tokens.css motion/lucio-morph.js logo/favicon.svg logo/lucio-chop-chen.svg; do
|
||||
if [ ! -f "$brand_dir/$required" ]; then
|
||||
echo "sync-brand: $brand_dir/$required not found (set LUCIO_IP_DIR)" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
mkdir -p "$out_dir"
|
||||
|
||||
strip_js() {
|
||||
perl -0777 -pe 's{(\x22(?:\\.|[^\x22\\\n])*\x22|\x27(?:\\.|[^\x27\\\n])*\x27|\x60(?:\\.|[^\x60\\])*\x60)|/\*.*?\*/|//[^\n]*}{defined $1 ? $1 : ""}gse; s/\r//g; s/[ \t]+$//mg; s/\n{2,}/\n/g; s/\A\n+//'
|
||||
}
|
||||
|
||||
strip_svg() {
|
||||
perl -0777 -pe 's/\r//g; s/<!--.*?-->//gs; s/\n{2,}/\n/g'
|
||||
}
|
||||
|
||||
{
|
||||
echo ":root {"
|
||||
perl -0777 -ne 'if (/:root\s*\{(.*?)\n\}/s) { print $1 }' "$brand_dir/tokens/tokens.css" \
|
||||
| perl -0777 -pe 's{/\*.*?\*/}{}gs' \
|
||||
| grep -E '^\s*--lucio-(graphite|paper|beam|steel|cinnabar|ash|font|space|radius|shadow-glow|motion|ease)[a-z0-9-]*:' \
|
||||
| sed -E 's/^\s+/ /'
|
||||
echo "}"
|
||||
} > "$out_dir/tokens.css"
|
||||
|
||||
strip_js < "$brand_dir/motion/lucio-morph.js" > "$out_dir/lucio-morph.js"
|
||||
strip_svg < "$brand_dir/logo/favicon.svg" > "$out_dir/favicon.svg"
|
||||
strip_svg < "$brand_dir/logo/lucio-chop-chen.svg" > "$out_dir/lucio-chop-chen.svg"
|
||||
|
||||
echo "sync-brand: copied tokens.css, lucio-morph.js, favicon.svg, lucio-chop-chen.svg from $brand_dir into $out_dir"
|
||||
Reference in new issue
Block a user