旧的CSS文件渲染 [英] Old CSS file rendering

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

问题描述

几天来我一直在构建一个ASP.NET MVC 5项目,主要是在玩CSS文件.但是,突然之间,用于在浏览器中显示HTML的CSS文件已恢复为旧版本.

I have been building an ASP.NET MVC 5 project for a few days, and mainly playing around with the CSS file. However, all of a sudden, the CSS file which is being use to display the HTML in a browser has reverted to an old version.

BundleConfig.cs 中,我有:

bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));

〜/Content/site.css 文件在过去几天中得到了增量更新,当我从Visual Studio中运行该程序时,在HTML中观察到了这些更改.

And the ~/Content/site.css file has been incrementally updated over the last few days, with the changes being observed in the HTML when I run the program from Visual Studio.

但是今天,我注意到呈现的HTML突然变得完全不同.当我在Firefox中查看源代码时,在< head> 标记中显示:

But today, I noticed that the rendered HTML is suddently entirely different. When I View Source in Firefox, in the <head> tag it shows:

< link href ="/Content/site.css" rel ="stylesheet"/>

如预期的那样.但是,如果我单击此源文件中指向此CSS文件的链接,那么它将显示几天前一个非常老的CSS文件中的内容.我已经多次检查 Content/site.css 上的文件确实是我的新版本,而不是这个旧版本.我曾尝试清理,重建,重新启动Visual Studio等,但这些都不起作用.

as would be expected. But if I click on the link to this CSS file from this source file, then it displays the contents from a very old CSS file from a few days ago. I have checked multiple times that the file at Content/site.css is indeed my new version, and not this old version. I have tried cleaning, rebuilding, restarting Visual Studio etc., but none of these make a difference.

这很奇怪-关于我可能要做的事情的任何想法都试图找出正在发生的事情?

This is very strange - any ideas on what I might to do try to figure out what's going on?

谢谢!

推荐答案

在大多数情况下,此问题与浏览器缓存有关,您需要执行的是强制浏览器重新加载页面并加载缓存再次.

This problem, most of the times, is related to the browser cache, what you need to do is to force the browser to reload the page and load the cache again.

对于Google Chrome :
通过按 Ctrl + Shift + I 启动Developer Tools/inspector窗口,然后右键单击刷新按钮,将出现一个上下文菜单,单击 Empty cache and hard reload

对于Firefox(在Developer Edition上经过测试)单击 Ctrl + r 或按住 Ctrl ,然后按 F5 .

For Google Chrome:
Launch the Developer tools/inspector window by pressing Ctrl + Shift + I, and then right click on the refresh button, a context menu will appear, click on Empty cache and hard reload

For Firefox (Tested on Developer Edition) Click Ctrl + r or hold Ctrl and then press F5.

我遇到了与您相同的问题,按 Ctrl + r 为我解决了该问题,因为我使用的是 Firefox开发人员版.

I had the same problem as yours, pressing Ctrl + r solved the problem for me, as I'm using Firefox Developer Edition.

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

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