MVC4捆绑:由于css3-feature,缩小失败?

时间:2013-10-14 13:30:20

标签: css asp.net-mvc css3 asp.net-mvc-4 bundling-and-minification

我想使用MVC4捆绑和缩小,但我总是在我的未缩小的css文件中将此错误消息作为注释:

/* Minification failed. Returning unminified contents.
(534,29): run-time error CSS1019: Unexpected token, found ' '
(534,29): run-time error CSS1019: Unexpected token, found ' '
(534,29): run-time error CSS1042: Expected function, found ' '
(534,29): run-time error CSS1062: Expected semicolon or closing curly-brace, found ' '
(535,26): run-time error CSS1019: Unexpected token, found ' '
(535,26): run-time error CSS1019: Unexpected token, found ' '
(535,26): run-time error CSS1042: Expected function, found ' '
(535,26): run-time error CSS1062: Expected semicolon or closing curly-brace, found ' '
(536,25): run-time error CSS1019: Unexpected token, found ' '
(536,25): run-time error CSS1019: Unexpected token, found ' '
(536,25): run-time error CSS1042: Expected function, found ' '
(536,25): run-time error CSS1062: Expected semicolon or closing curly-brace, found ' '
(537,24): run-time error CSS1019: Unexpected token, found ' '
(537,24): run-time error CSS1019: Unexpected token, found ' '
(537,24): run-time error CSS1042: Expected function, found ' '
(537,24): run-time error CSS1062: Expected semicolon or closing curly-brace, found ' '
 */

CSS中的相应行是:

width: -webkit-calc(100% - 0.5em);
width: -moz-calc(100% - 0.5em);
width: -ms-calc(100% - 0.5em);
width: -o-calc(100% - 0.5em);

我可以做些什么来缩小使用css3的计算功能?

2 个答案:

答案 0 :(得分:1)

我不确定您是否能够在当前的实施中使用它。我想你在这里有两件事要对你不利。

  1. 根据http://www.w3.org/standards/techs/css#w3c_all几乎所有内容仍然是工作草案。如果它会发生变化,那么在System.Web.Optimization中实施某些内容可能是不值得的,并且从长远来看会导致更多问题。

  2. calc()目前是CSS Values and Units Module Level 3的一部分,其中声明:

      

    以下功能存在风险,可能会在CR期间被删除:'calc()','toggle()','attr()'。“

  3. 所以有了这些东西,微软可能不会处于CSS3的最前沿。当然,这很可能是一个错误,因为该语法并非完全脱离困境。希望他们尽快开源System.Web.Optimization,以便人们可以解决这样的问题。但他们一直承诺开源近一年了。

    与此同时,您可以尝试在机器上本地预先绑定文件,您可以对其进行大量控制。或者尝试使用其他捆绑/缩小系统,例如Cassette

答案 1 :(得分:1)

我回答我自己的问题,告诉你我现在使用捆绑变压器 YUI Compressor 相关联。这工作得非常好,语法与Microsoft方式非常相似 看看吧!

相关问题