【问题标题】:Openshift glyphicons not workingOpenshift 字形图标不起作用
【发布时间】:2015-09-02 05:48:15
【问题描述】:

我刚刚部署到 openshift 并意识到应用页面未正确呈现。字形图标不见了。我在控制台Failed to decode downloaded font: ...../fonts/glyphicons-halflings-regular.woff2 中收到此错误。不知道是什么原因造成的,可能是 MIME 映射的原因吗?我尝试添加正确的映射,但没有成功。找到一些thread,但可能不相关。

知道如何调查吗?

【问题讨论】:

    标签: spring twitter-bootstrap


    【解决方案1】:

    问题在于从 bootstrap 的定制工具下载的 glyphicon 字体文件与从 bootstrap 主页上的重定向下载的字体文件不一样。那些可以正常工作的是可以从以下链接下载的那些:

    http://getbootstrap.com/getting-started/#download

    任何对旧的错误定制器文件有问题的人都应该覆盖上面链接中的字体。

    【讨论】:

    • 文件接缝是相同的,无论如何我已经更新到新的引导程序但没有成功。也许是 Openshift 特有的?
    • 仍然打开,没有变化。在本地工作,但不是在通过 openshift 部署时。在firefox firebug中尝试过,但它只是显示错误的字形并且没有给出任何警告或错误(只有chrome显示上面写的错误)
    【解决方案2】:

    所以问题是微不足道的 maven-resource-plugin 以某种方式破坏了字体文件,所以只需在 pom.xml 中添加以下内容即可停止过滤这些文件

      <resources>
                <resource>
                    <directory>src/main/resources</directory>
                    <filtering>true</filtering>
                    <excludes>
                        <exclude>**/*.ttf</exclude>
                        <exclude>**/*.eot</exclude>
                        <exclude>**/*.woff</exclude>
                        <exclude>**/*.woff2</exclude>
                    </excludes>
                </resource>
                <resource>
                    <directory>src/main/resources</directory>
                    <filtering>false</filtering>
                    <includes>
                        <include>**/*.ttf</include>
                        <include>**/*.eot</include>
                        <include>**/*.woff</include>
                        <include>**/*.woff2</include>
                    </includes>
                </resource>
            </resources>
    

    【讨论】:

      【解决方案3】:

      woff2 是新的,不在我的 debian jessie 服务器上的 /etc/mime.types 中。所以我写了一行

      AddType application/font-woff2  .woff2
      

      到 Apaches mods-enabled/mime.conf - 现在它可以完美运行了。 您可以在另一个邮件中找到更多信息:Proper MIME Type for woff2

      【讨论】:

        猜你喜欢
        • 2017-03-25
        • 2015-07-11
        • 2015-04-12
        • 1970-01-01
        • 2014-10-09
        • 2014-07-17
        • 2016-11-08
        • 1970-01-01
        相关资源
        最近更新 更多