I've read that I can use /stylesheets/default.css?{{ App.Version }} for the versioning of the css files on Google App Engine. How does it work? I tried putting the ?{{ App.Version }} at the end of my css files but it brokes the whole page. Am I doing something wrong?

有帮助吗?

解决方案

You don't put version info at the end of your filename, you just append a "version" query parameter when you reference the CSS resources.

  1. Don't change CSS/JS (or other static file) filenames, just change contents
  2. Refer to those files in your HTML via <link rel="stylesheet" type="text/css" href="//host/path/file.css?version">
  3. Everytime you change contents you increase version. You could also use application versions, but you'd have to make sure they do not repeat.
  4. Default caching on static files is 10min. You can set your own cache expiration.

其他提示

You should append the version number, i.e. (for Java):

String version = SystemProperty.applicationVersion.get();

You can append this string to your CSS file name in your host page.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top