Simple lektor sass plugin

- Using python's libsass to compile the final CSS
Closes #4
This commit is contained in:
Felipe M 2020-11-30 18:13:36 +01:00
parent 6ceae7c22c
commit cba44a38fc
Signed by: fmartingr
GPG key ID: 716BC147715E716F
11 changed files with 216 additions and 5519 deletions

View file

@ -0,0 +1,22 @@
import sass
from lektor.pluginsystem import Plugin
from werkzeug.utils import cached_property
class SassifyPlugin(Plugin):
name = "Sassify"
description = "Sassify"
def on_before_build_all(self, builder, **extra):
sass.compile(
dirname=(
self.config["sassify"]["src_path"],
self.config["sassify"]["dest_path"],
),
output_style="compressed",
)
@cached_property
def config(self):
conf = self.get_config()
return {section: conf.section_as_dict(section) for section in conf.sections()}

14
packages/sassify/setup.py Normal file
View file

@ -0,0 +1,14 @@
from setuptools import setup
setup(
name="lektor-sassify",
version="0.1",
py_modules=["lektor_sassify"],
entry_points={
"lektor.plugins": [
"sassify = lektor_sassify:SassifyPlugin",
]
},
install_requires=["libsass==0.20.1"],
)