fix, feat, doc: massive build system refactorion, bug fixes and apex documentation (#19)
This commit is contained in:
1 parent
e8b42c60c2
commit
91f5245823
165 files changed
+8598
-1205
No files matched your search
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
STATIC_DIR="$SCRIPT_DIR/../../services/www/public/static"
|
||||
|
||||
if [ ! -d "$STATIC_DIR" ]; then
|
||||
echo "Directory $STATIC_DIR does not exist. Skipping."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Optimizing images in $STATIC_DIR using cwebp..."
|
||||
|
||||
# Find all png, jpg, jpeg files
|
||||
find "$STATIC_DIR" -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" \) | while read -r file; do
|
||||
# Determine output path (replace extension with .webp)
|
||||
dir=$(dirname "$file")
|
||||
base=$(basename "$file")
|
||||
ext="${base##*.}"
|
||||
name="${base%.*}"
|
||||
output="$dir/$name.webp"
|
||||
|
||||
# Check if webp already exists and is newer
|
||||
if [ -f "$output" ] && [ "$output" -nt "$file" ]; then
|
||||
echo "Skipping $file (already optimized)"
|
||||
else
|
||||
echo "Optimizing: $file -> $output"
|
||||
cwebp -q 80 "$file" -o "$output"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Image optimization complete!"
|
||||
Reference in new issue
Block a user