问题描述
这是关于如何通过 python 将 SASS 编译为 CSS 的文档,包括设置 output_style='compressed'
的可能性:
https://sass.github.io/libsass-python/
import sass
sass.compile(dirname=('sass','css'),output_style='compressed')
以下是如何在每个部署者上执行此操作,这正是我所需要的: https://sass.github.io/libsass-python/frameworks/flask.html#building-sass-scss-for-each-deployment
# setyp.py
setup(
# ...,setup_requires=['libsass >= 0.6.0'],sass_manifests={
'myapp': ('static/sass','static/css','/static/css')
}
)
但是,我需要在编译 SASS 时按照第二页中描述的方式设置 output_style
,但我不知道该怎么做。有什么办法可以做到吗?
解决方法
找到解决方案
将 setup.cfg
更改如下:
[aliases]
sdist = build_sass --output-style compressed sdist
bdist = build_sass --output-style compressed bdist
插入
[aliases]
sdist = build_sass sdist
bdist = build_sass bdist