I'm using Assetic to include Javascript files, but when used in the dev environment, /app_dev.php
is added to the beginning of the URL, so the final url looks like /app_dev.php/js/something.js
. This results in a 404 when trying to load the JS. When I access the site from the production environment the URLs don't include /app_dev.php
and everything works fine.
I could add a conditional that checks if it's the dev environment and call str_replace
on the URLs, but I'd like to solve the root of this problem, if possible.
Edit
@gilden, I would understand that in dev they would get processed every time, but the URLs simply result in 404s.
Here's my Assetic config:
assetic:
debug: %kernel.debug%
use_controller: false
filters:
cssrewrite: ~
# closure:
# jar: %kernel.root_dir%/java/compiler.jar
# yui_css:
# jar: %kernel.root_dir%/java/yuicompressor-2.4.2.jar
And here's how I'm using it in my template (app/Resources/views/base.html.php)
foreach ($view['assetic']->javascripts(
array('@AssetsBundle/Resources/public/js/*'), array(), array('output' => 'js/combined.js')) as $url) {
echo 'url: ' . $url . '<br />';
}
I then include $url using a custom helper I wrote, but it already contains app_dev.php at that point.