Reputation: 23
Who knows how to add versions to assets that was loaded inside Assetic blocks globally ?
Added to my config.yml
templating:
engines: ['twig']
assets_version: v2
it works for regular assets, but doesn't for asset_url inside stylesheets and javascripts assetic blocks Am I doing somethg wrong or it's some kind of a bug ?
small upd. it doesn't work without assets_version_format
Upvotes: 1
Views: 3209
Reputation: 21834
It works for me.
config.yml:
framework:
templating:
engines: ['twig']
assets_version: 1.0.1
assets_version_format: '%%s?v=%%s'
Example:
{% javascripts '@DashboardBundle/Resources/public/js/config.js' %}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
Result:
<script type="text/javascript" src="/js/config.js?v=1.0.1"></script>
If you want to test in dev environment:
config_dev.yml:
assetic:
use_controller: false
app_dev.php :
$kernel = new AppKernel('dev', false);
Then in your terminal:
php app/console assets:install
php app/console assetic:dump
php app/console cache:clear --env=dev --no-debug
Upvotes: 2