Whi*_*ler 31 asp.net asp.net-mvc
我已经做了我的第一个网站使用MVC 5这在我的本地机器上工作正常,但当我把它发布到服务器的一些CSS的不正确加载.
/* Minification failed. Returning unminified contents.
(80,1): run-time error CSS1019: Unexpected token, found '@import'
(80,9): run-time error CSS1019: Unexpected token, found 'url('../Content/dark-skin/skin.css')'
(671,16): run-time error CSS1062: Expected semicolon or closing curly-brace, found ':'
(1288,16): run-time error CSS1062: Expected semicolon or closing curly-brace, found ':'
(1680,1): run-time error CSS1019: Unexpected token, found '@keyframes'
(1682,5): run-time error CSS1062: Expected semicolon or closing curly-brace, found '50%'
(1685,1): run-time error CSS1019: Unexpected token, found '@-webkit-keyframes'
(1687,5): run-time error CSS1062: Expected semicolon or closing curly-brace, found '50%'
*/
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. The notices and licenses below are for informational purposes only.
*
* NUGET: END LICENSE TEXT */
/*!
* Bootstrap v3.0.0
*
* Copyright 2013 Twitter, Inc
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world by @mdo and @fat.
*//*! normalize.css v2.1.0 | MIT License | git.io/normalize */
Run Code Online (Sandbox Code Playgroud)
我知道编译器正在尝试最小化css文件但是没有这样做.我试图纠正这些错误,但在纠正其中一些并再次发布后,错误看起来是一样的,就像没有选择我的更改.
甚至最奇怪的是bootstrap.css文件,我为了网站的目的稍作修改.当我发布它时,更改不在bundle文件中.是否有可能从Bootstrap服务器广告而不是我的项目加载引导程序?
bundles.Add(new StyleBundle("~/Content/cssmain").Include(
"~/Content/bootstrap.css",
"~/Content/site.css",
"~/Content/ilightbox.css",
"~/Content/bannerscollection_zoominout.css"));
Run Code Online (Sandbox Code Playgroud)
我也尝试使用Web应用程序自己进行缩小,但我的更改不可见,文件看起来没有减少.
任何帮助表示赞赏
tre*_*rmf 22
我通过做两件事来解决捆绑bootstrap.css的问题:
请注意,如果您使用的是特定主题,请将bootstrap.css和bootstrap.min.css替换为主题提供的文件.这是我的项目中使用spacelab主题的工作代码:
bundles.Add(new StyleBundle(GetStyleBundlePath("bootstrap")).Include(
"~/Content/3rdParty/bootstrap.spacelab.css",
"~/Content/3rdParty/bootstrap-datepicker.css",
"~/Content/3rdParty/bootstrap-multiselect.css"));
Run Code Online (Sandbox Code Playgroud)

小智 14
对于那些可能在这篇文章中绊倒的人...你也可以通过将@import移动到第一个捆绑项来解决这个问题.
根据:http://webdesign.about.com/cs/css/qt/tipcssatimport.htm
@Import必须始终是CSS文档中的第一个.将多个CSS文件捆绑在一起时,它会将它们链接到一个捆绑的css文件中.由于第二个css文件添加到我的包中,在bundle config中,在开始时包含一个@Import,因为文件被链接在一起,@ import会出现在新合并文档的中间.一旦我更改了捆绑订单,问题就解决了.
这一点很重要,因为虽然您可以使用像bootstrap这样的插件提供的缩小文件,但在开发过程中对非缩小文件所做的任何更改都不会添加到现有的缩小css文件中.这意味着您必须进行两次更改,并在缩小的文件中导航.
我们遇到了相同的问题,事实证明bootstrap.css是问题。我们收到了与您在上面编写的相同的缩小错误。捆绑器在中有问题@import,@keyframes并且@-webkit-keyframes在css文件中。
我们解决该问题的方法是从捆绑中删除bootstrap.css,然后直接在Shared / _Layout.cshtml中引用它(或缩小版本,如果有的话)。
@Styles.Render("~/Content/bootstrap.min.css")
@Styles.Render("~/Content/css")
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
31740 次 |
| 最近记录: |