#!/usr/bin/env bash set -euo pipefail ROOT="${1:-.}" BASE="$ROOT/frontend/public" [ -d "$BASE" ] || { echo "❌ Dossier $BASE introuvable"; exit 1; } script_tag='' # Inject before 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## ${script_tag} #g" "$page" echo "➕ header.js -> $page" fi done < <(find "$BASE" -type f -name "*.html" -print0) echo "✅ Injection terminée."