From 8dfb94e6e59e8b616f3df9b7b9520009249ec620 Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Mon, 7 Jun 2021 11:23:58 +0100 Subject: [PATCH] Update Add-Remove-BOM.ps1 Former-commit-id: 2da443b9e89fa446bc2ef4535a117727da84ab54 [formerly dc543763283af6879e0be1d97a6ef1929a99f05c [formerly 07ec84d2a5fa2e488791997009980855d76aa8f1]] Former-commit-id: 8314aad2f670bb3d19036a996e900628d4176999 Former-commit-id: e9fcabf193434fd1b64d3acdad2eece23873b28f --- scripts/Add-Remove-BOM.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/Add-Remove-BOM.ps1 b/scripts/Add-Remove-BOM.ps1 index e8dbdd06..626b9c74 100644 --- a/scripts/Add-Remove-BOM.ps1 +++ b/scripts/Add-Remove-BOM.ps1 @@ -9,7 +9,7 @@ if ($filename -eq "") { $filename = Read-Host "Enter the directory for processing: " } " " -ls -r -name $filename *.js +ls -r -name $filename -Include @('*.js','*.css','*.html') if ($nobom) { $input = Read-Host "`nAll the above files will have the BOM (if any) removed!`nProceed? (Y/N)" } else { @@ -18,10 +18,10 @@ if ($nobom) { if ($input -eq "Y") { if ($nobom) { "Removing Byte Order Mark ..." - ls -r $filename *.js | % { [System.IO.File]::WriteAllLines($_.FullName, ((Get-Content $_.FullName) -replace "^\xEF\xBB\xBF", ""))} + ls -r $filename -Include @('*.js','*.css','*.html') | % { [System.IO.File]::WriteAllLines($_.FullName, ((Get-Content $_.FullName) -replace "^\xEF\xBB\xBF", ""))} } else { "Adding Byte Order Mark ..." - ls -r $filename *.js | % { + ls -r $filename -Include @('*.js','*.css','*.html') | % { $document = Get-Content -encoding "UTF8" $_.FullName if ($document -match "^(?!\xEF\xBB\xBF)") { $document | Set-Content -encoding "utf8BOM" $_.FullName