php - 如何修复 "Add myBundle to the asseticBundle conf

当我尝试使用 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

我该如何解决这个问题?

最佳答案

是的,我试过了,它为我解决了这个问题。对于最初不知道如何添加的人(比如我),然后只是:

  1. 编辑 app/config/config.yml
  2. 然后转到 assetic:
  3. 在 Assets 下:转到bundles:[]
  4. and in bundles: []//输入你的包名

例如,如果您的 bundle 是 Acme\DemoBundle,则执行以下操作

assetic:
   bundles: [ AcmeDemoBundle ]

AcmeDemoBundle 周围没有引号。而已。 (Symfony2)

关于php - 如何修复 "Add myBundle to the asseticBundle config"symfony2 异常?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12222900/

相关文章:

php - Doctrine 2 和带有额外字段的多对多链接表

php - 命令不同步;你现在不能运行这个命令

php - 如何增加php中的执行超时?

php - Composer : How to find the exact version of

php - 使用查询字符串和 anchor 标签形成正确的 URL

php - PDO mysql : How to know if insert was succes

php - PHP 内爆的 Python 等价物?

php - 如何正确地在 PHP 中对字符串进行 URL 编码?

javascript - 使用 ajax 请求下载文件

php - 什么是 .tpl 文件? PHP,网页设计