我目前正在尝试设置Flask Web应用程序,并尝试使用Flask-Assets将较少的文件编译为缩小的CSS.
这是我创建捆绑包的assets.py文件.
from flask_assets import Bundle
common_css = Bundle(
'vendor/less/theme.less',
filters='less',
output='static/css/common.css',
)
Run Code Online (Sandbox Code Playgroud)
我得到的错误是:
OSError: [Errno 2] No such file or directory
Run Code Online (Sandbox Code Playgroud)
在较少过滤器的webassets文档中,它说:
This depends on the NodeJS implementation of less, installable via npm. To use the old Ruby-based version (implemented in the 1.x Ruby gem), see Less.
...
LESS_BIN (binary)
Path to the less executable used to compile source files. By default, the filter will attempt to run lessc via the system …Run Code Online (Sandbox Code Playgroud) 当我直接运行烧瓶应用程序时它们正常运行但在uWSGI下运行时不编译或替换模板中的地址.
我该怎么调试呢?
编辑:
代码:assets =环境(app)
...
if __name__ == "__main__":
assets.register(YAMLLoader(os.path.join(DIR,"assets.yml")).load_bundles())
if os.environ.get("DEBUG_FLASK"):
app.run()
else:
app.run(debug=True)
Run Code Online (Sandbox Code Playgroud)
assets.yml:
style_css:
filters: less
output: css/style.css
contents:
- css/style.less
Run Code Online (Sandbox Code Playgroud) 我在python webassets库中使用pyscss编译器,webassets调试配置全部设置为true.但是当我对scss文件进行更改并重新加载包含生成的css文件的页面时,我发现css文件没有重新生成,也没有包含我的更改.为什么会这样?