开发者

Ideas for how to alter file-names of static assets to prevent out-dated browser cached versions of asset files

开发者 https://www.devze.com 2023-03-25 16:57 出处:网络
I have a website that I host with PHPFog. PHPFog, for those who don\'t know, makes it very easy to deploy an app to multiple application servers with a simple git-push. I would love it if there was so

I have a website that I host with PHPFog. PHPFog, for those who don't know, makes it very easy to deploy an app to multiple application servers with a simple git-push. I would love it if there was some way to automatically update the version number of my javascript/css files with every git-commit or git-push. Or somehow maybe just append the 'build' unix timestamp to the filename. The goal of course to queue browsers to reloa开发者_JS百科d the asset file instead of going with the cached version. Does anyone know of a good way to do this?


You can append a bogus query string to your CSS files - such as

styles.css?<?php print $release; ?>

The release identifier can be anything you want - perhaps a timestamp, git hashref, or tag.

0

精彩评论

暂无评论...
验证码 换一张
取 消