From 8a2450dff6406d0ba104d5efd62ebfab5236cba4 Mon Sep 17 00:00:00 2001 From: nathaninline Date: Wed, 22 Jul 2026 10:23:52 +0200 Subject: [PATCH] assemble.ps1: marqueurs tolerants LF/CRLF (autocrlf) + remplacement via MatchEvaluator (contenu JS avec \$ intact) --- ui/assemble.ps1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ui/assemble.ps1 b/ui/assemble.ps1 index e661a16..fdeb0d8 100644 --- a/ui/assemble.ps1 +++ b/ui/assemble.ps1 @@ -18,10 +18,13 @@ $css = [IO.File]::ReadAllText((Join-Path $src 'styles.css')) $js = (Get-ChildItem (Join-Path $src 'js') -Filter '*.js' | Sort-Object Name | ForEach-Object { [IO.File]::ReadAllText($_.FullName) }) -join '' +# le marqueur et SA fin de ligne sont remplacés (LF ou CRLF selon le checkout) ; +# chaque source apporte ses propres fins de ligne → sortie byte-stable. foreach ($m in '@@CSS@@', '@@JS@@') { - if (-not $tmpl.Contains("$m`n")) { throw "marqueur $m introuvable dans index.tmpl.html" } + if ($tmpl -notmatch "$m`r?`n") { throw "marqueur $m introuvable dans index.tmpl.html" } } -$html = $tmpl.Replace("@@CSS@@`n", $css).Replace("@@JS@@`n", $js) +$html = [regex]::Replace($tmpl, "@@CSS@@`r?`n", { $css }) +$html = [regex]::Replace($html, "@@JS@@`r?`n", { $js }) [IO.File]::WriteAllText($dst, $html, [Text.UTF8Encoding]::new($false)) Write-Host "OK -> $dst ($([IO.File]::ReadAllBytes($dst).Length) octets)"