[英]MVC4 bundling: Minification failed because of 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
某些內容,並且長期造成更多問題,可能不值得花System.Web.Optimization
。
calc()
當前屬於CSS值和單位模塊第3級 ,其中指出:
以下功能存在風險,可能在CR期間被刪除:“ calc()”,“ toggle()”,“ attr()”。”
因此,就這些事情而言,微軟可能不會處於CSS3的前沿。 當然,這很可能是一個錯誤,因為該語法還沒有完全解決。 希望他們盡快開源System.Web.Optimization
以便人們可以解決此類問題。 但是他們已經承諾將其開源近一年了。
同時,您可以嘗試在機器上對其進行很多控制的本地本地預打包文件。 或嘗試使用其他類似Cassette的捆綁/縮小系統。
我回答我自己的問題,告訴您我現在將Bundle Transformer與YUI Compressor結合使用 。 這確實很好,語法與Microsoft的方式非常相似。
看看它!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.