Files
medical-mall/fix_all_font_weights_v2.py

29 lines
910 B
Python

import os
import re
target_dir = r'e:\companyproject\mall'
count = 0
for root, dirs, files in os.walk(target_dir):
for file in files:
if file.endswith('.uvue'):
file_path = os.path.join(root, file)
try:
with open(file_path, 'r', encoding='utf-8') as f:
content = f.read()
# Regex replace font-weight: \s*600 with font-weight: 700
new_content = re.sub(r'font-weight:\s*600', 'font-weight: 700', content)
if content != new_content:
print(f"Fixing {file_path}")
with open(file_path, 'w', encoding='utf-8') as f:
f.write(new_content)
count += 1
except Exception as e:
print(f"Error processing {file_path}: {e}")
print(f"Fixed {count} files.")