After reading this thread: How to force browser to reload cached CSS/JS files?
I would like to know if there is any built-in function or easy way in Symfony that automatically forces a reload by appending a random querystring or timestamp to the link when it has discovered that javascript / css file has been modified. (Normally, people use the use_javascript function to generate the <script> tag)
There is no built-in mechanism, but a little creativity means you can do this just about anywhere in your code, from view.yml to layout.php to each individual action.
The view.yml method is easy enough:
apps/frontend/config/view.yml:
Although I think this is a little too active, and I tend to use either the SVN revision or a overall project version number:
where
app_project_versionis set in apps/frontend/config/app.yml. Methods for layout.php and actionSuccess.php should be easy enough from here: