Header menu via header.js
This commit is contained in:
20
apply_header_patch.sh
Executable file
20
apply_header_patch.sh
Executable 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."
|
||||
Reference in New Issue
Block a user