mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-11 17:26:57 +02:00
assemble.ps1: marqueurs tolerants LF/CRLF (autocrlf) + remplacement via MatchEvaluator (contenu JS avec \$ intact)
This commit is contained in:
1 parent
0770723ef0
commit
8a2450dff6
1 file changed
+5
-2
+5
-2
@@ -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)"
|
||||
Reference in new issue
Block a user