Symfony 2 misuses path using use_controllers: false

I tried to set use_controllers to false in debug mode, because on my machine it takes 5 to 15 seconds, then I manually created the assets.

The generated files are great, but when I open the page in my browser, the css or js files do not load. I looked into the developer tools and saw that symfony was trying to download files from "localhost / _controller / js / 08f6dbe_jquery-1.7.2.min_1.js". If I delete the "_controller" in the path manually, it works fine, but I have no idea why symfony is generating the wrong path.

Some codes:

#config_dev.yml assetic: use_controller: false 

base.html.twig

 {% javascripts '../app/Resources/public/js/libs/jquery-1.7.2.min.js' <script type="text/javascript" src="{{ asset_url }}"></script> {% endjavascripts %} 

I hope you can help me and sorry for the bad english

+4
source share
3 answers

You can set output = "js / *. Js" on your twitter

 {% javascripts '../app/Resources/public/js/libs/jquery-1.7.2.min.js' output='js/*.js' <script type="text/javascript" src="{{ asset_url }}"></script> {% endjavascripts %} 

This should generate something like this: "//localhost/js/f31e898_jquery_.js"
you can replace * with the actual name "jquery", for example, but to avoid caching its beter to use *.

hope this helps

+2
source

It just had to clear your cache. I had the same thing with me when changing the configuration, but you need to manually cache the application / console: clear the development environment. It will not work with simple page refresh.

+12
source

I had exactly the same problem, but it was fixed after clearing the cache

php app/console cache:clear

+5
source

All Articles