Files
CityCards-Website/src/batch_replace_fonts.py

94 lines
2.8 KiB
Python
Raw Normal View History

2025-10-09 19:03:24 +05:30
#!/usr/bin/env python3
import os
import re
# List of files to update
files_to_update = [
"components/BlogsPage.tsx",
"components/HowItWorksPage.tsx",
"components/ProfilePage.tsx",
"components/EsimsPage.tsx",
"components/AttractionsPage.tsx",
"components/FAQPage.tsx",
"components/MelbourneBlogs.tsx",
"components/CityAttractionsPage.tsx",
"components/BlogDetailsPage.tsx",
"components/VarietyOfAdventures.tsx",
"components/MelbourneFAQ.tsx",
"components/MelbournePage.tsx",
"components/MelbourneCardComparison.tsx",
"components/BookAttractionSection.tsx",
"components/PassesPage.tsx",
"components/CheckoutPage.tsx",
"components/DownloadAppPage.tsx",
"components/WhyChooseUsSection.tsx",
"components/PrivacyPolicyPage.tsx",
"components/MobileAppPromotion.tsx",
"components/OffersPage.tsx",
"components/ContactUsPage.tsx",
"components/WhyChooseCityCards.tsx",
"components/HotelDiscountsPage.tsx",
"components/MagicItinerary.tsx",
"components/NewsletterSection.tsx",
"components/PostCardsPage.tsx",
"components/HeroSection.tsx",
"components/MelbourneTourOverview.tsx",
"components/ItineraryViewPage.tsx",
"components/CityCardsPage.tsx",
"components/MagicItineraryPage.tsx",
"components/CreateMagicItineraryPage.tsx",
"components/SecureCheckoutPage.tsx",
"components/AttractionDetailsPage.tsx",
"components/AboutUsPage.tsx"
]
def replace_in_file(filepath):
"""Replace font-merchant with font-poppins in a file."""
try:
with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
# Count replacements
count = content.count('font-merchant')
if count == 0:
print(f"{filepath} - already updated")
return 0
# Replace all instances
new_content = content.replace('font-merchant', 'font-poppins')
# Write back
with open(filepath, 'w', encoding='utf-8') as f:
f.write(new_content)
print(f"{filepath} - replaced {count} instances")
return count
except FileNotFoundError:
print(f"{filepath} - file not found")
return 0
except Exception as e:
print(f"{filepath} - error: {e}")
return 0
def main():
print("Starting batch font replacement...")
print("=" * 50)
total_replacements = 0
files_updated = 0
for filepath in files_to_update:
count = replace_in_file(filepath)
if count > 0:
files_updated += 1
total_replacements += count
print("=" * 50)
print(f"\nCompleted!")
print(f"Files updated: {files_updated}")
print(f"Total replacements: {total_replacements}")
if __name__ == "__main__":
main()