-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix_fa.py
More file actions
29 lines (23 loc) · 790 Bytes
/
fix_fa.py
File metadata and controls
29 lines (23 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import sys
files = [
'about.html',
'contact.html',
'affiliate-disclosure.html',
'privacy-policy.html',
'terms-of-service.html'
]
fa_tag = '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">'
count = 0
for filepath in files:
with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
if fa_tag not in content:
print(f"Adding Font Awesome to {filepath}")
content = content.replace(
'<link rel="stylesheet" href="style.css">',
'<link rel="stylesheet" href="style.css">\n ' + fa_tag
)
with open(filepath, 'w', encoding='utf-8') as f:
f.write(content)
count += 1
print(f"Fixed {count} files.")