Symfony2 BootstrapBundle:没有“更少”过滤器

时间:2015-04-22 13:39:28

标签: php twitter-bootstrap symfony assetic

我想在symfony项目中使用BraincraftedBootstrapBundle。 我按照此页面上给出的步骤操作:http://bootstrap.braincrafted.com/getting-started.html

我收到以下错误:

# php app/console assetic:dump
Dumping all dev assets.
Debug mode is on.




  [InvalidArgumentException]  
  There is no "less" filter.  



assetic:dump [--forks="..."] [--watch] [--force] [--period="..."] [write_to]

这是我的config.yml文件:

...
assetic:
    filters:
        less:
            node: /usr/sbin/node
            node_paths: /usr/local/lib/node_modules
            apply_to: "\.less$"
        cssrewrite: ~

braincrafted_bootstrap:
    less_filter: less

1 个答案:

答案 0 :(得分:2)

config.yml中看一下您可能已经安装的assetic声明。您需要将新配置添加到已定义的项目中。 (因为你的新声明将被忽略。)

在标准安装中,您可能有类似

的内容
# Assetic Configuration
assetic:
    debug:          "%kernel.debug%"
    use_controller: false
    bundles:        [ ]
    #java: /usr/bin/java
    filters:
        cssrewrite: ~
        #closure:
        #    jar: "%kernel.root_dir%/Resources/java/compiler.jar"
        #yui_css:
        #    jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"

将新配置添加到该资产项目,使其成为:

# Assetic Configuration
assetic:
    debug:          "%kernel.debug%"
    use_controller: false
    bundles:        [ ]
    #java: /usr/bin/java
    filters:
        cssrewrite: ~
        #closure:
        #    jar: "%kernel.root_dir%/Resources/java/compiler.jar"
        #yui_css:
        #    jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"
        less:
            node: /usr/local/bin/node
            node_paths: [/usr/local/lib/node_modules]
            apply_to: "\.less$"
        cssrewrite: ~