gitea_pages/frontend/compile_css.py
2023-05-21 18:58:10 +02:00

26 lines
589 B
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import glob
import sys
from pathlib import Path
EXTENSIONS = ("*.css", "*.sass", "*.scss")
def compile(p):
print("==========")
print(f"{p}:")
dist = Path(sys.argv[2], *p.with_suffix(".css").parts[1:])
print(f"\tWriting to: {dist}")
print(f"\tCreating dir: {dist.parent}")
dist.parent.mkdir(parents=True, exist_ok=True)
prompt = f"sassc {p} > {dist}"
print(f"\tInvoking sassc: {prompt}")
os.system(prompt)
for ext in EXTENSIONS:
for p in Path(sys.argv[1]).rglob(ext):
compile(p)