Decision:
use the syntax @ ...
{% image '@VendorMyShopBundleBundle/Resources/public/images/example.jpg' output='/images/example.jpg' %} <img src="{{ asset_url }}" alt="Example"/> {% endimage %}
Please note that the Provider / YourBundle / Resources / public will NOT normally be available to your web server.
Assets: the installation command will copy the assets to web / bundles / vendoryourbundle
The {{asset ('path / to / asset.jpg')}} function will adjust the URL of your resource if you use the dev environment:
http:
from
/path/to/asset.jpg
to
/app_dev.php/to/asset.jpg
[EDIT]
If you want more control over your assets, consider using asset collections .
You can configure them as follows:
and use them in the template as follows:
{% stylesheets '@css_bootstrap' %} <link rel="stylesheet" type="text/css" href="{{ asset_url }}"> {% endstylesheets %}
I'm NOT sure right now if the assetic / assets / packagename / input configuration array supports @VendorYourBundle syntax and then uses package inheritance.
Addition:
Before you can use these packages, you will need to use the console command:
php app/console assetic:dump
source share