无法使用 python 为 libsass 设置 output_style,以便在每次部署时编译 SASS

Cannot set output_style for libsass using python to compile SASS on each deploy

这里是关于如何通过 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