I have template for example index.html.php where I use php assetic loader like this
<?php foreach ($view['assetic']->javascripts( array('@AcmeFooBundle/Resources/public/js/*')) as $url): ?> <script type="text/javascript" src="<?php echo $view->escape($url) ?>"></script> <?php endforeach; ?>
If I do any changes for my template file I get Route "_assetic_2b431f4" does not exist.
If I change
assetic: use_controller: false
I get Cannot load resource ".". Error.
This comes when I do even one line change to file, so something about the cache. Clearing cache don't help etc. Any Ideas?
You have to go into routing_dev.yml and remove these lines:
_assetic:
resource: .
type: assetic
Then everything should work.
This answer was also given here:
How to make Symfony2 to load CSS, JS files directly and not via PHP?
EDIT: And if you haven't done so already, make sure you've done the whole
php app/console assetic:dump
thing that's given in the documentation:
http://symfony.com/doc/current/cookbook/assetic/asset_management.html#dumping-asset-files