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

我想使用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的calc功能一起使用?

最佳答案 我不确定你是否能够在当前的实现中使用它.我想你在这里有两件事对你不利.

>每http://www.w3.org/standards/techs/css#w3c_all几乎所有东西仍然是一个工作草案.在System.Web.Optimization中实现某些功能可能是不值得的,如果它会发生变化,从长远来看会导致更多问题.
> calc()目前是CSS Values and Units Module Level 3的一部分,其中规定:

The following features are at-risk and may be dropped during the CR period: ‘calc()’, ‘toggle()’, ‘attr()’.”

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

在此期间,您可以尝试在您的计算机上本地预先绑定文件,您可以对其进行大量控制.或者尝试不同的捆绑/缩小系统,如Cassette.

点赞