我正在尝试在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"
有什么问题?因为,很明显,函数标签通常存在于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 }
谢谢
答案 0 :(得分:1)
这应该有效:
# Twig Configuration
assetic:
twig:
functions:
jpegoptim: { output: images/*.jpg }