Search code examples
symfonycachingbrowser-cacheasseticuglifyjs

Symfony cache busting / Assetic minification


I have a problem with cache busting after minifying my js files via uglify using method from here: http://symfony.com/doc/current/cookbook/assetic/uglifyjs.html

After minifying my files are loaded as 1f4daf9.js without assets version which is set in the config.
My uglify filter is configured like this:

 filters:
    uglifyjs2:
        bin: /usr/local/bin/uglifyjs

And what I want to achive is to get 1f4daf9.js?r1234 name with assets version so the browser is forced to reload it. So how can I do that?


Solution

  • Found answer on https://stackoverflow.com/a/27900224/3922926
    You actually need to use {{ asset(asset_url) }} instead of {{ asset_url }} since it doesn't add version to asset_url automatically.