PythonGallery/packages/onlylegsSass.py
Fluffy-Bean a7e79ab5a5 Fixed multiple requests for images
Started adding SQL table layouts
Making package loading prettier
2023-01-06 15:47:58 +00:00

36 lines
No EOL
1.1 KiB
Python

import time
import sys
import os
class Sassy():
def __init__(self, theme):
print("### OnlyLegs Theme Manager ###")
try:
import sass
except ImportError:
print("Could not find libsass!")
print("Exiting...")
sys.exit(1)
path_to_sass = os.path.join('usr', 'themes', theme, 'style.scss')
if os.path.exists(path_to_sass):
print(f"Theme '{theme}' found at:", path_to_sass)
self.sass = sass
self.loadTheme(path_to_sass)
else:
print("No theme found!")
print("Exiting...")
sys.exit(1)
def loadTheme (self, theme):
with open('static/css/style.css', 'w') as f:
try:
f.write(self.sass.compile(filename=theme, output_style='compressed'))
print("Compiled successfully to:", f.name)#
print("Finished\n")
except self.sass.CompileError as e:
print("Failed to compile! Full error:\n", e)
print("Exiting...")
sys.exit(1)