1

我正在尝试在 Symfony 2 中使用 jpegoptim

这是我的 config.yml

# Twig Configuration
twig:
    functions:
        jpegoptim: { output: images/*.jpg }
    debug:            %kernel.debug%
    strict_variables: %kernel.debug%

当我运行程序时出现此错误:

InvalidConfigurationException: Unrecognized options "functions" under "twig"

怎么了 ?因为,很明显,functions 标签通常存在于 twig 标签下

注意:我的资产配置

assetic:
 debug:          %kernel.debug%
 use_controller: false
 bundles:        [DemoAsseticGestionRessourcesBundle]
 filters:
    cssrewrite: ~
    jpegoptim:
         bin: %kernel.root_dir%/Ressources/bin/jpegoptim/jpegoptim.exe
    #closure:
    #    jar: %kernel.root_dir%/Resources/java/compiler.jar
    yui_js:
        jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
    yui_css:
        jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
 twig:
    functions:
    jpegoptim: { output: images/*.jpg }

谢谢

4

1 回答 1

1

这应该有效:

# Twig Configuration
assetic:
    twig:
        functions:
            jpegoptim: { output: images/*.jpg }
于 2013-11-13T15:35:49.257 回答