【发布时间】:2012-08-26 17:13:18
【问题描述】:
当我尝试使用 TWIG {% javascript %} 标记链接到我的 .js 文件时,它返回给我,但出现以下异常:
An exception has been thrown during the compilation of a template ("You must add CompetitiongameBundle to the assetic.bundle config to use the {% javascripts %} tag in CompetitiongameBundle:game:index.html.twig.") in "CompetitiongameBundle:game:index.html.twig".
我的index.html.twig 看起来像:
{% javascripts 'CompetitiongameBundle/Resources/views/public/js/*'%}
<script type="text/javascript" src="{{ asset_url }}" ></script>
{% endjavascripts %}
Hello {{ name }}!
<a href='{{ nexturl }}' >Login</a>
当我这样做时,我的 Bundle 已经存在于配置文件中:
php app/console config:dump-reference assetic
我该如何解决这个问题?
【问题讨论】:
-
检查这个问题和两个建议的解决方案:stackoverflow.com/questions/10376946/…
-
如果你真的选择了这个问题的答案,那就太好了。