# W10: extract second inline ') if ($matches.Count -lt 2) { Write-Host "Not enough style blocks"; exit 0 } $second = $matches[1] $cssContent = $second.Groups[1].Value $cssPath = Join-Path $repo 'css\homepage-extra.min.css' [System.IO.File]::WriteAllText($cssPath, $cssContent) # Replace the second with link tag $replacement = '' $newC = $c.Substring(0, $second.Index) + $replacement + $c.Substring($second.Index + $second.Length) [System.IO.File]::WriteAllText($idx, $newC) $newMatches = [regex]::Matches($newC, '(?s)]*>(.*?)') $total = ($newMatches | ForEach-Object { $_.Groups[1].Value.Length } | Measure-Object -Sum).Sum Write-Host "Extracted $($cssContent.Length) bytes to css/homepage-extra.min.css; inline CSS now: $total bytes"