In Symfony2 how can I append a date to the assetic filenames

戏子无情 提交于 2019-12-06 05:43:20

I suggest, in order to have control over browser's cache, do the following:

app/config/config.yml

framework:
   templating:
       assets_version: %assets_version%

This setting will make assetic append ?vX to asset url (X is your %asset_version% parameter).

parameters.yml

parameters:
    assets_version: 1

You need to change your asset version each time you want to deploy new version of assets and make user browser to fetch new content.

There is also AssetsVersionBundle which adds command to increase %assets_version% for you. Just type

app/console assets_version:increase

Documentation of this bundle covers assets versioning issue pretty well

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!