mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-09 12:19:46 -04:00
Update Add-Remove-BOM.ps1
Former-commit-id: 2da443b9e89fa446bc2ef4535a117727da84ab54 [formerly dc543763283af6879e0be1d97a6ef1929a99f05c [formerly 07ec84d2a5fa2e488791997009980855d76aa8f1]] Former-commit-id: 8314aad2f670bb3d19036a996e900628d4176999 Former-commit-id: e9fcabf193434fd1b64d3acdad2eece23873b28f
This commit is contained in:
parent
a4672df89e
commit
8dfb94e6e5
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user