IIS CSS缓存 [英] IIS CSS Caching

查看:183
本文介绍了IIS CSS缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们开发新网站或测试新的网站或测试更改涉及css后,新的代码提交和有人去检查更改,他们总是看到一个缓存版本的旧css。这是在测试中导致很多问题,因为人们不能确定他们是否在屏幕上有最新的css(我知道shift和点击刷新清除这个缓存,但我不能指望终端用户知道这样做)。

如果你是从静态文件(或任何查询字符串不提供你的CSS)提供你的CSS,我可能的解决方案是什么?



styles.css?token = 1234,并在每个CSS签入中更改token的值。


When we are developing new sites or testing changes in new ones that involve css after the new code is committed and someone goes to check the changes they always see a cached version of the old css. This is causing a lot of problems in testing because people never are sure if they have the latest css on screen (I know shift and clicking refresh clears this cache but I can't expect end users to know to do this). What are my possible solutions?

解决方案

If you're serving your CSS from static files (or anything that the query string doesn't matter for), try varying that to ensure that the browser makes a fresh request, as it will think that it's pulling a completley different resource, so have for example:

"styles.css?token=1234" in the CSS reference in your markup and change the value of "token" on each CSS check-in

这篇关于IIS CSS缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆