import re
import os

js = open('lms/src_app_pages_pages_module_ts.js', encoding='utf-8').read()

os.makedirs("all-style-blocks", exist_ok=True)

matches = re.findall(r'styles:\s*\[(.*?)\]', js, re.S)

print("Found", len(matches), "style blocks")

for i, css in enumerate(matches):
    with open(f'all-style-blocks/style-{i}.css', 'w', encoding='utf-8') as f:
        f.write(css)

print("Done")
