如何在Webassets中传递过滤器特定的配置选项 [英] How to pass filter specific configuration options in webassets

查看:342
本文介绍了如何在Webassets中传递过滤器特定的配置选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用烧瓶 flask-assets webassets
我试图通过一个特定的过滤器的特定配置webassets,但到目前为止还没有能够这样做。



多次阅读文档无济于事。也经历了源代码,但也没有帮助。

细节:


  • 我试图使用的过滤器是 cleancss

  • 我试图传递的特定配置是 - skip -rebase






根据cleancss文档的链接上面,我应该能够通过 CLEANCSS_EXTRA_ARGS 中的 - skip-rebase 选项。但我在哪里放?



到目前为止我尝试过,作为烧瓶配置变量:

  CLEANCSS_EXTRA_ARGS = ['--skip-rebase']#实际工作,请参阅答案! 
CLEANCSS_EXTRA_ARGS = ['skip-rebase']#不起作用!
ASSETS_CLEANCSS_EXTRA_ARGS = ['--skip-rebase']#不起作用!
FLASK_ASSETS_CLEANCSS_EXTRA_ARGS = ['--skip-rebase']#不起作用!
ASSETS_CLEANCSS_EXTRA_ARGS = ['skip-rebase']#不起作用!
FLASK_ASSETS_CLEANCSS_EXTRA_ARGS = ['skip-rebase']#不起作用!






ps:我也尝试修改源代码来检查如果cleancss参数被正确地传递到命令行,那么问题只是在应用程序配置中正确指定选项。

解决方案<

  CLEANCSS_EXTRA_ARGS = ['--skip-rebase']在重试时, 

有效!

更多信息在烧瓶资产回购问题

在我的匆忙,我一定尝试过:

 CLEANCSS_EXTRA_ARGS = ['skip-rebase'] 

因此这个问题。




这个特性应该记录下来。请注意,这需要版本0.11(webassets)及以上版本。
$ b




/ p>

Using , , I am trying to pass a filter specific configuration for a particular filter in webassets, but haven't been able to do so, so far.

Have read the documentation multiple times to no avail. Have also gone through the source code, but that hasn't helped either.

Specifics:

  • The filter I'm trying to use is cleancss
  • And the particular configuration I'm trying to pass is --skip-rebase

According to the link to cleancss docs above, I should be able to pass the --skip-rebase option in CLEANCSS_EXTRA_ARGS. But where do I put that?

What I've tried so far, passing as flask config variables:

CLEANCSS_EXTRA_ARGS = ['--skip-rebase']  # actually works, see answer!
CLEANCSS_EXTRA_ARGS = ['skip-rebase']  # doesn't work!
ASSETS_CLEANCSS_EXTRA_ARGS = ['--skip-rebase']  # doesn't work!
FLASK_ASSETS_CLEANCSS_EXTRA_ARGS = ['--skip-rebase']  # doesn't work!
ASSETS_CLEANCSS_EXTRA_ARGS = ['skip-rebase']  # doesn't work!
FLASK_ASSETS_CLEANCSS_EXTRA_ARGS = ['skip-rebase']  # doesn't work!


ps: I also tried modifying the source to check if cleancss parameters are being correctly passed to the command line, and it is, so the problem is only in specifying the option correctly in the app configuration.

解决方案

On retrying with the first option in question:

CLEANCSS_EXTRA_ARGS = ['--skip-rebase']

It worked!

More info available in the flask assets repo issues.

In my hurry I must have tried with:

CLEANCSS_EXTRA_ARGS = ['skip-rebase']

which didn't work and hence the question.


This feature should be documented though. Will probably submit a pull request for doc improvement.


Also note that this requires version 0.11 (webassets) and above.

这篇关于如何在Webassets中传递过滤器特定的配置选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆