Assetic unable to find file

拜拜、爱过 提交于 2019-12-03 05:45:22

Unless you need to whitelist some bundles for Assetic, just remove the bundles option from the config.

daslicht

The following works for me:

  1. Create bundle e.g.:

    php app/console generate:bundle --namespace=Acme/Bundle/BlogBundle --no-interaction
    

    See: Generating a New Bundle Skeleton

  2. Add Assetic imports as the following:

    {% javascripts '@AcmeBlogBundle/Resources/public/js/*' %}
    <script type="text/javascript" src="{{ asset_url }}"></script>
    {% endjavascripts %}
    
  3. Add Bundle to assetic config:

    # Assetic Configuration
    assetic:
        ...
        bundles:        ['AcmeBlogBundle']
        ...
    

I had this same issue and elnur's suggestion worked. Here's my assetic config for your reference

# 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"
        yui_js:
            jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!