我真的在ASP.NET工作的一個項目MVC 4,我做以下步驟:Twitter的引導glyphicons不會出現在釋放模式404
下載Twitter的引導從http://blog.getbootstrap.com/2013/12/05/bootstrap-3-0-3-released/
套裝建立在字體文件的行動內容(文件位於〜/內容/字體文件夾)
glyphicons-halflings-regular.eot glyphicons-halflings-regular.svg glyphicons-halflings-regular.ttf glyphicons-halflings-regular.woff
添加到RouteConfig.cs
routes.IgnoreRoute(「{folder}/{* pathInfo}」,new {folder =「Content」});
添加以下元素處理web.config
<?xml version="1.0" encoding="UTF-8"?> <system.webServer> <staticContent> <remove fileExtension=".eot" /> <remove fileExtension=".ttf" /> <remove fileExtension=".otf"/> <remove fileExtension=".woff"/> <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" /> <mimeMap fileExtension=".ttf" mimeType="font/ttf" /> <mimeMap fileExtension=".otf" mimeType="font/otf" /> <mimeMap fileExtension=".woff" mimeType="font/x-woff" /> </staticContent> </system.webServer>
包括以下代碼BundleConfig.cs
bundles.Add(new StyleBundle("~/bundles/maincss") .Include("~/Content/bootstrap/bootstrap.css") .Include("~/Content/bootstrap/bootstrap-theme.css") .Include("~/Content/hbl-full.css"));
還與下面的代碼試圖
IItemTransform cssFixer = new CssRewriteUrlTransform(); bundles.Add(new StyleBundle("~/bundles/maincss") .Include("~/Content/bootstrap/bootstrap.css", cssFixer) .Include("~/Content/bootstrap/bootstrap-theme.css", cssFixer) .Include("~/Content/hbl-full.css", cssFixer));
在主Layout.cshtml調用
@ Styles.Render( 「〜/捆綁/ maincss」)
不過通常示出,但是當我推代碼以釋放服務器,我只能看,而不是圖標,並在Chrome`s控制檯選項卡廣場,我得到
GET http://domain.apphb.com/fonts/glyphicons-halflings-regular.woff 404(未找到)測試:1
GET http://domain.apphb.com/fonts/glyphicons-halflings-regular.ttf 404(未找到)測試:1
GET 404(未找到)測試:1
謝謝。
如若將mimeType爲WOFF文件是'< 「WOFF」 mimeMap fileExtension = mime類型= 「應用/字體WOFF」/>' ? –
感謝您展示第4部分,這正是我需要知道在Twitter Bootstrap中使用圖標的原因。 –