标签: webassets

使用Flask-Assets编译较少的文件

我目前正在尝试设置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)

python less flask webassets flask-assets

6
推荐指数
1
解决办法
2682
查看次数

在uWSGI下运行时,Flask Assets包不会编译

当我直接运行烧瓶应用程序时它们正常运行但在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)

flask uwsgi webassets flask-assets

6
推荐指数
1
解决办法
341
查看次数

为什么python webassets pyscss不会在调试模式下从scss文件重新生成css?

我在python webassets库中使用pyscss编译器,webassets调试配置全部设置为true.但是当我对scss文件进行更改并重新加载包含生成的css文件的页面时,我发现css文件没有重新生成,也没有包含我的更改.为什么会这样?

css python debugging sass webassets

3
推荐指数
1
解决办法
747
查看次数

标签 统计

webassets ×3

flask ×2

flask-assets ×2

python ×2

css ×1

debugging ×1

less ×1

sass ×1

uwsgi ×1