Assetic cannot find file

I am trying to link a css file (which lives in a package) inside a branch template:

{% stylesheets '@AcmeFooBundle/Resources/public/css/bootstrap.min.css' %} <link href="{{ asset_url }}" rel="stylesheet"/> {% endstylesheets %} 

The first error message I get:

You must add AcmeFooBundle to the assetic.bundle configuration ...

This is config:

 # 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 

Then I try to add AcmeFooBundle to the bundles directive, but then I get an error:

Unable to find file ....

I can't understand what I'm doing wrong here ...

Resetting the default configurations to the console configuration in the console (using php app / console config: dump-reference assetic ) I see the AcmeFooBundle package specified in the packages directive ...

+13
symfony assetic
Apr 29 '12 at 23:35
source share
3 answers

If you don’t need to whitelist some packages for Assetic, just remove the bundles option from the configuration.

+28
Apr 30 '12 at 4:13
source share

The following works for me:

  • Create a package, for example:

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

    See: Creating a new skafang skeleton

  • Add Assetic import as follows:

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

     # Assetic Configuration assetic: ... bundles: ['AcmeBlogBundle'] ... 
+14
Dec 26 '12 at 14:44
source share

I had the same problem and the elnur suggestion worked. Here is my summary configuration 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" 
+3
Jul 28 '12 at 5:14
source share



All Articles