I'm starting at creating my own bundles and upload them to github.
I have just created this: https://github.com/Ziiweb/FrontendBundle
Inside the bundle, there is an image here: https://github.com/Ziiweb/FrontendBundle/tree/master/Resources/public/images
And I'm loading that image this way below inside a template in the same bundle, in the same way as it said in the docs:
{% image '@ZiiwebFrontendBundle/Resources/public/images/ajax-loader.gif' %}
<img class="loader" src="{{ asset_url }}" alt="Example" />
{% endimage %}
The problem: after installing the bundle (composer) in another project, I get the error below when trying to request the template where the image is:
An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "_assetic_0b1c853_0" as such route does not exist.") in ZiiwebFrontendBundle:Default:contact.html.twig at line 15.
I get the same message using this code:
{% image 'bundles/ziiwebfrontend/images/ajax-loader.gif' %}
<img class="loader" src="{{ asset_url }}" alt="Example" />
{% endimage %}
Yes, I have installed the assets using assets:install
so my image is at web/bundles/ziiwebfrontend/images/ajax-loader.gif
.
NOTE: I think I have Assetic installed correctly.. I have used these 3 steps.
I think you missed to add same bundle in config.yml
assetic:
debug: %kernel.debug%
use_controller: false
bundles: [YourBundleName]