Header menu via header.js

This commit is contained in:
karim hassan
2025-08-24 23:47:39 +00:00
parent f1103d67a0
commit eabd0aa50f
25 changed files with 869 additions and 185 deletions

20
apply_header_patch.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="${1:-.}"
BASE="$ROOT/frontend/public"
[ -d "$BASE" ] || { echo "❌ Dossier $BASE introuvable"; exit 1; }
script_tag='<script type="module" src="/assets/header.js?v=1"></script>'
# Inject before </body> in all .html if not already present
while IFS= read -r -d '' page; do
if ! grep -q 'assets/header.js' "$page"; then
sed -i '' -e "s#</body># ${script_tag}
</body>#g" "$page"
echo " header.js -> $page"
fi
done < <(find "$BASE" -type f -name "*.html" -print0)
echo "✅ Injection terminée."