Updated Doormile website
This commit is contained in:
28
scratch/fix_css_paths.ps1
Normal file
28
scratch/fix_css_paths.ps1
Normal file
@@ -0,0 +1,28 @@
|
||||
$dirs = "assets/css/vendor", "assets/css/sections", "assets/css/widgets"
|
||||
foreach ($dir in $dirs) {
|
||||
if (Test-Path $dir) {
|
||||
$files = Get-ChildItem -Path $dir -Filter *.css -Recurse
|
||||
foreach ($file in $files) {
|
||||
$content = Get-Content $file.FullName -Raw
|
||||
$changed = $false
|
||||
|
||||
if ($content -like '*../fonts/*') {
|
||||
$content = $content.Replace('../fonts/', '../../fonts/')
|
||||
$changed = $true
|
||||
}
|
||||
if ($content -like '*assets/images/*') {
|
||||
$content = $content.Replace('assets/images/', '../../images/')
|
||||
$changed = $true
|
||||
}
|
||||
if ($content -like '*assets/fonts/*') {
|
||||
$content = $content.Replace('assets/fonts/', '../../fonts/')
|
||||
$changed = $true
|
||||
}
|
||||
|
||||
if ($changed) {
|
||||
$content | Set-Content $file.FullName
|
||||
Write-Host "Updated $($file.FullName)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
scratch/fix_css_paths.py
Normal file
31
scratch/fix_css_paths.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import os
|
||||
|
||||
dirs = [r'assets/css/vendor', r'assets/css/sections', r'assets/css/widgets']
|
||||
replacements = [
|
||||
('../fonts/', '../../fonts/'),
|
||||
('assets/images/', '../../images/'),
|
||||
('assets/fonts/', '../../fonts/')
|
||||
]
|
||||
|
||||
for d in dirs:
|
||||
if not os.path.exists(d):
|
||||
print(f"Directory {d} does not exist")
|
||||
continue
|
||||
for root, _, files in os.walk(d):
|
||||
for f in files:
|
||||
if f.endswith('.css'):
|
||||
path = os.path.join(root, f)
|
||||
try:
|
||||
with open(path, 'r', encoding='utf-8', errors='ignore') as file:
|
||||
content = file.read()
|
||||
|
||||
new_content = content
|
||||
for old, new in replacements:
|
||||
new_content = new_content.replace(old, new)
|
||||
|
||||
if new_content != content:
|
||||
with open(path, 'w', encoding='utf-8') as file:
|
||||
file.write(new_content)
|
||||
print(f"Updated {path}")
|
||||
except Exception as e:
|
||||
print(f"Error processing {path}: {e}")
|
||||
Reference in New Issue
Block a user