我目前正在尝试设置一个 Flask Web 应用程序,并尝试使用Flask-Assets将我的 less 文件编译成缩小的 css。
这是我创建捆绑包的 assets.py 文件。
from flask_assets import Bundle
common_css = Bundle(
'vendor/less/theme.less',
filters='less',
output='static/css/common.css',
)
我得到的错误是:
OSError: [Errno 2] No such file or directory
在less filterwebassets的文档中,它说:
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 path.
我安装了lessusing $ npm install less,但由于某种原因它看起来webassets无法使用它。
当我尝试使用不同的过滤器时,webassets可以成功创建捆绑包。
谢谢!