I have two CSS files in the same folder, with identical access rights. When testing in the same Twig file, one CSS file generates a URL to the file and loads perfectly and one gives an error.
An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "_assetic_a328b4c_0" as such route does not exist.") in @GutensiteStream/Stream35163.html.twig at line 19.
ls -al /var/www/core/cms/src/Templates/GutensiteAdminBundle/Resources/public/css
-rw-rw-r-- 1 chadwick developer 17K Feb 7 14:00 dashboard.css
-rw-rw-r-- 1 chadwick developer 49K Feb 6 16:00 site.css
{% stylesheets '@TemplatesGutensiteAdminBundle/Resources/public/css/site.css' %}
<link rel="stylesheet" href="{{ asset_url }}">
{% endstylesheets %}
{% stylesheets '@TemplatesGutensiteAdminBundle/Resources/public/css/dashboard.css' %}
<link rel="stylesheet" href="{{ asset_url }}">
{% endstylesheets %}
<link rel="stylesheet" href="/gutensite/v/2/0/bundles/templatesgutensiteadmin/css/dashboard.css">
I have already cleared cache multiple times, via app/console cache:clear
and via rm -rf app/cache/*
. I use php app/console assets:install --symlink /var/www/core/web/gutensite/v/2/0/
to symlink the public files to the bundles, and of course they are accessible (as demonstrated via the direct link).
assetic:
#don't use dynamic links to assets, use full production paths
use_controller: false
When I ran into this error, the solution was quite simple:
When in doubt:
bin/console cache:clear
Assetic is looked for a cached version which doesn't exist. This could be for any number of reasons, but cache:clear
seems like it should be the first stop.