相关疑难解决方法(0)

Twitter引导程序字形不会出现在发布模式404中

我正在ASP.NET MVC 4中的一个项目,我做了以下步骤:

  1. http://blog.getbootstrap.com/2013/12/05/bootstrap-3-0-3-released/下载的twitter bootstrap

  2. 将字体文件的构建操作设置为内容(文件位于〜/ Content/font文件夹中)

    glyphicons-halflings-regular.eot
    glyphicons-halflings-regular.svg
    glyphicons-halflings-regular.ttf
    glyphicons-halflings-regular.woff
    
    Run Code Online (Sandbox Code Playgroud)
  3. 添加到RouteConfig.cs

    routes.IgnoreRoute("{folder}/{*pathInfo}",new {folder ="Content"});

  4. 向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>
    
    Run Code Online (Sandbox Code Playgroud)
  5. 包含在BundleConfig.cs中的以下代码

    bundles.Add(new StyleBundle("~/bundles/maincss")
                        .Include("~/Content/bootstrap/bootstrap.css")
                        .Include("~/Content/bootstrap/bootstrap-theme.css")
                        .Include("~/Content/hbl-full.css"));
    
    Run Code Online (Sandbox Code Playgroud)

    还尝试使用以下代码

    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));
    
    Run Code Online (Sandbox Code Playgroud)
  6. 在主Layout.cshtml中调用

    @ Styles.Render( "〜/捆绑/ maincss")

仍然在localhost图标正常显示,但当我推送代码发布服务器时,我只能看到方形而不是图标,在Chrome的控制台选项卡中我得到

获取http://domain.apphb.com/fonts/glyphicons-halflings-regular.woff 404(未找到)测试:1 …

c# asp.net asp.net-mvc twitter-bootstrap glyphicons

34
推荐指数
4
解决办法
2万
查看次数

捆绑和缩小字体真棒css.在mvc 4

我试图缩小字体awesome.css但是当我最小化它显示内容的不同垃圾字符,如:

{ content: "\f048"; }
Run Code Online (Sandbox Code Playgroud)

以上是像箭头等内容图标....

有什么办法可以解决这个问题?

谢谢

css minify asp.net-mvc-4 bundling-and-minification font-awesome

6
推荐指数
1
解决办法
3899
查看次数

在捆绑了 Bootstrap 的 ASP.NET MVC 应用程序中使用 Glyphicons

我有一个包含 bootstrap 的 ASP.NET MVC 应用程序。我的目录结构如下所示:

/
  /App_Start
    BundleConfig.cs
  /Content
    app.css
    bootstrap.min.css
  /Fonts
    glyphicons-halflings-regular.eot
    glyphicons-halflings-regular.svg
    glyphicons-halflings-regular.ttf
    glyphicons-halflings-regular.woff
    glyphicons-halflings-regular.woff2
Run Code Online (Sandbox Code Playgroud)

我需要将 Bootstrap 捆绑到我的应用程序中。在我的 BundleConfig.cs 文件中,我有以下内容:

public static void RegisterBundles(BundleCollection bundles)
{
  bundles.Add(new StyleBundle("~/public/bundles/css")
    .Include("~/Content/bootstrap.min.css")
    .Include("~/Content/app.css")
  );

  bundles.Add(new ScriptBundle("~/public/bundles/scripts")
    .Include("~/Scripts/jquery-2.1.4.min.js")
    .Include("~/Scripts/jquery-ui-1.11.4.min.js")
    .Include("~/Scripts/bootstrap.min.js")
    .Include("~/Scripts/jquery.validate.min.js")
    .Include("~/Scripts/jquery.validate.unobtrusive.min.js")
  );
}
Run Code Online (Sandbox Code Playgroud)

当捆绑关闭时,一切都呈现良好。当我打开捆绑时,除了字体图标之外,一切都呈现良好。当我查看控制台窗口时,我看到与字体图标相关的 5 404 错误。它就像尝试引用字体文件,如下所示:

http://localhost:9090/public/fonts/glyphicons-halflings-regular.woff2

然而,它们并不存在于公共目录中。我不知道如何解决这个问题。

asp.net-mvc

2
推荐指数
1
解决办法
6585
查看次数