我最近不得不从我的团队资源管理器下载我网站的新版本。现在使用正确的 css 文件似乎有问题。就好像它正在某处查看旧版本,但我不知道为什么或在哪里查看。
我已经检查了 bundle ,它具有正确的文件名/位置。我已经检查了该文件,它包含正确的代码。
这是我的代码
布局(直到头部减去分析)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title - Coverpools Dealer Portal</title>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport" content="width=device-width" />
@Styles.Render("~/Content/magnific_css")
@Scripts.Render("~/bundles/modernizr")
<link href="~/Content/magnific-popup.css" rel="stylesheet" />
@Styles.Render("~/Content/themes/base/css")
@Styles.Render("~/Content/css")
</head>
bundle (包括所有,以防我遗漏某些东西)
using System.Web;
using System.Web.Optimization;
namespace Infotech.Coverpools.Portal.Tintaglia.Web
{
public class BundleConfig
{
// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/quotes").Include(
"~/Scripts/jquery-{version}.js",
"~/Scripts/jquery-ui-{version}.js",
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*",
"~/Scripts/quotes.js"));
bundles.Add(new ScriptBundle("~/bundles/magnific").Include(
"~/Scripts/jquery.magnific-popup.min.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/site.css",
"~/Content/PagedList.css",
"~/Content/Responsive.css",
"~/Content/custom.css")); // this is the custom file I believe it should be pulling
bundles.Add(new StyleBundle("~/Content/magnific_css").Include("~/Content/magnific-popup.css"));
bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
"~/Content/themes/base/jquery.ui.core.css",
"~/Content/themes/base/jquery.ui.resizable.css",
"~/Content/themes/base/jquery.ui.selectable.css",
"~/Content/themes/base/jquery.ui.accordion.css",
"~/Content/themes/base/jquery.ui.autocomplete.css",
"~/Content/themes/base/jquery.ui.button.css",
"~/Content/themes/base/jquery.ui.dialog.css",
"~/Content/themes/base/jquery.ui.slider.css",
"~/Content/themes/base/jquery.ui.tabs.css",
"~/Content/themes/base/jquery.ui.datepicker.css",
"~/Content/themes/base/jquery.ui.progressbar.css",
"~/Content/themes/base/jquery.ui.theme.css"));
}
}
}
我本地站点的 custom.css(它应该位于 ..Web/Content/custom.css 中)
/* main layout
----------------------------------------------------------*/
/* site title
----------------------------------------------------------*/
/* login
----------------------------------------------------------*/
/* NOTICE THIS SECTION IS MISSING THE RUNNING VERSION menu
----------------------------------------------------------*/
ul#accountMenu {
font-size: 1em;
font-weight: 600;
margin: 0 0 5px;
padding: 0;
text-align: left;
}
ul#accountMenu li {
display: inline;
list-style: outside none none;
padding-left: 15px;
}
ul#accountMenu li a {
background: rgba(0, 0, 0, 0) none repeat scroll 0 0;
color: #999;
text-decoration: none;
}
ul#accountMenu li a:hover {
color: #333;
text-decoration: none;
}
/* page elements
----------------------------------------------------------*/
/*Text*/
.important-message{
color: red
}
/* featured */
/* page titles */
/* features */
/* ordered list */
/* content */
/* login page */
/* contact */
/* forms */
/* info and errors */
/* styles for validation helpers */
/* tables
----------------------------------------------------------*/
/********************
* Mobile Styles *
********************/
/*@media only screen and (max-width: 850x) { */
/* header
----------------------------------------------------------*/
/* logo */
/* login */
/* menu */
/* main layout
----------------------------------------------------------*/
/* page content */
/* ordered list */
/* features */
/* forms */
/* login page */
/* mobile footer
----------------------------------------------------------*/
custom.css(来自运行版本)
/* main layout
----------------------------------------------------------*/
/* site title
----------------------------------------------------------*/
/* login
----------------------------------------------------------*/
/* menu
----------------------------------------------------------*/
/* page elements
----------------------------------------------------------*/
/* featured */
/* page titles */
/* features */
/* ordered list */
/* content */
/* login page */
/* contact */
/* forms */
/* info and errors */
/* styles for validation helpers */
/* tables
----------------------------------------------------------*/
/********************
* Mobile Styles *
********************/
@media only screen and (max-width: 850x) {
/* header
----------------------------------------------------------*/
/* logo */
/* login */
/* menu */
/* main layout
----------------------------------------------------------*/
/* page content */
/* ordered list */
/* features */
/* forms */
/* login page */
/* mobile footer
----------------------------------------------------------*/
生成 HTML 到 Head
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>All Users - Coverpools Dealer Portal</title>
<link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport" content="width=device-width" />
<link href="/Content/magnific-popup.css" rel="stylesheet"/>
<script src="/Scripts/modernizr-2.6.2.js"></script>
<link href="/Content/magnific-popup.css" rel="stylesheet" />
<link href="/Content/themes/base/jquery.ui.core.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.resizable.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.selectable.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.accordion.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.autocomplete.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.button.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.dialog.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.slider.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.tabs.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.datepicker.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.progressbar.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.theme.css" rel="stylesheet"/>
<link href="/Content/site.css" rel="stylesheet"/>
<link href="/Content/PagedList.css" rel="stylesheet"/>
<link href="/Content/Responsive.css" rel="stylesheet"/>
<link href="/Content/custom.css" rel="stylesheet"/>
</head>
我什至尝试对 custom.css 进行硬编码,但仍然得到相同的 custom.css 文件。就好像它正在其他地方寻找文件。
最佳答案
似乎存在浏览器的缓存问题不同的浏览器有不同的缓存策略虽然你的 css 缓存在浏览器中所以它总是变旧了我想让你做的只是放 ?foo=1234
在你的 css/js 导入结束时,将 1234 更改为你喜欢的任何内容。查看 SO html 源代码以获取示例。
有这样的想法吗?参数在请求中无论如何都会被丢弃/忽略,您可以在推出新版本时更改该数字。
或
按 ctrl+R
尝试执行HARD REFRESH | Ctrl+Shift+R
| cntrl+F5
或者你可以在这个 link 找到如何硬刷新针对不同的浏览器
关于html - Visual Studio 在调试时提取错误的 CSS 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41841060/