我将一个MVC 5 Web应用程序部署到Azure,并发现datepicker主题(基本)未正确加载。
本地日期选择器:
Azure datepicker:
从挖掘Azure版本开始,我发现样式表并没有加载,尽管它们是本地的。显然这是问题,但我不知道如何解决它。
BundleConfig.cs:
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/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/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/jquery-ui-{version}.js",
"~/Scripts/DatePickerReady.js",
"~/Scripts/respond.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/themes/base/all.css",
"~/Content/site.css"));
_Layout.cshtml:
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
...
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
更新 检查应该出现日期选择器的字段,我发现这是一个缩小问题:
/* Minification failed. Returning unminified contents.
(31,1): run-time error CSS1019: Unexpected token, found '@import'
(31,9): run-time error CSS1019: Unexpected token, found '"base.css"'
(32,1): run-time error CSS1019: Unexpected token, found '@import'
(32,9): run-time error CSS1019: Unexpected token, found '"theme.css"'
答案 0 :(得分:0)
我有这个! 您是否已将这些文件包含在项目中? 单击所有文件按钮,如果文件未包含,则可能必须添加文件
答案 1 :(得分:0)
找到错误(在Azure部署的Web应用程序中的Datepicker字段上检查元素):
/* Minification failed. Returning unminified contents.
(31,1): run-time error CSS1019: Unexpected token, found '@import'
(31,9): run-time error CSS1019: Unexpected token, found '"base.css"'
(32,1): run-time error CSS1019: Unexpected token, found '@import'
(32,9): run-time error CSS1019: Unexpected token, found '"theme.css"'
我通过手动包含all.css导入的所有css文件来修改BundleConfig.cs:
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
// Code removed for clarity
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/themes/base/bootstrap.css",
"~/Content/themes/base/core.css",
"~/Content/themes/base/base.css",
"~/Content/themes/base/datepicker.css",
"~/Content/themes/base/theme.css",
"~/Content/site.css"));