Posts

Showing posts from October, 2016

Symfony - How to avoid browser caching assets even after production deployment.

All Browsers have some caching mechanism, they cache most of the css, javascript and images those are loaded frequently from an website. However, this might be a headache for a developer when they made changes to some of the JS, CSS but the changes are not reflected in website, unless you clear the local cache. The global standard is to change the file path name or add a query parameter to your asset as such : 1 example.com / assets / css / common.css ? v = 234 So to implement this Symfony framework supplies a straight forward solution in its asset configuration. It's called assset version . Just add below configuration to your config.yml and rest will be taken care by Symfony framework when it loads an asset to the template. 1 2 3 4 # config.yml framework: assets: version : 'v1451' The above settings is not limited to twog templates, If your application serves APIs and your response is in JSON or XML format, the above settings will als