This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
md-pdf/md_pdf/build/css.py

18 lines
421 B
Python
Raw Permalink Normal View History

2017-04-05 15:27:14 +01:00
from scss import Compiler
from md_pdf.consts import INTERNAL_STATIC_DIR
2017-04-05 15:27:14 +01:00
from md_pdf.build.pdf import STYLE_FILE
import os
STYLE_SRC_FILE = os.path.join(INTERNAL_STATIC_DIR, 'style.scss')
2017-04-05 15:27:14 +01:00
def render_css():
compiler = Compiler()
with open(STYLE_SRC_FILE) as f:
style = f.read()
with open(STYLE_FILE, 'w') as f:
data = compiler.compile_string(style)
f.write(data)
return data