14 lines
548 B
Python
Executable file
14 lines
548 B
Python
Executable file
with open('/workspace/ecommerce_research_sources/index.html', 'r', encoding='utf-8') as f:
|
|
html = f.read()
|
|
|
|
import re
|
|
# Replace inline script with external scripts
|
|
pattern = r'<script>\s*const bundle = .*?<\/script>'
|
|
replacement = '<script src="data_bundle.js"></script>\n <script src="app.js"></script>'
|
|
|
|
new_html = re.sub(pattern, replacement, html, flags=re.DOTALL)
|
|
|
|
with open('/workspace/ecommerce_research_sources/index.html', 'w', encoding='utf-8') as f:
|
|
f.write(new_html)
|
|
|
|
print("index.html updated with clean external scripts.")
|