【问题标题】:WARNING: JSF1091: No mime type detected for shared / variables.less file警告:JSF1091:没有为 shared/variables.less 文件检测到 mime 类型
【发布时间】:2015-12-20 03:16:20
【问题描述】:

我正在为 JSF/PrimeFaces Web 应用程序使用 MaterialAdmin 主题。

每次启动应用程序时,我都会针对每个 .less 文件收到此警告:

警告:JSF1091:未检测到共享/variables.less 文件的 mime 类型。要解决此问题,请将 mime 类型映射添加到应用程序的 web.xml 文件。

我试过了,但没有机会:

<web:mime-mapping>
    <extension>less</extension>
    <web:mime-type>text/plain</web:mime-type>
</web:mime-mapping>

【问题讨论】:

    标签: jsf less mime-types web.xml


    【解决方案1】:

    提供了一个web.xml,其根声明符合标准 Servlet 3.1 规范,如下所示(注意:没有 xmlns:web XML 命名空间!),

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app
        xmlns="http://xmlns.jcp.org/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
        version="3.1"
    >
        <!-- Config here. -->
    </web-app>
    

    那么您应该添加以下条目,以便将 less 扩展与 text/css mime 类型相关联(注意:没有 text/plain!):

    <mime-mapping>
        <extension>less</extension>
        <mime-type>text/css</mime-type>
    </mime-mapping>
    

    不要忘记重建/重新部署/重新启动。 web.xml 仅在应用程序启动时解析一次。

    【讨论】:

    • 重建是关键,我之前已经尝试过 text/css 但它没有锻炼,因为我没有进行新的 Maven 构建。谢谢你:)
    猜你喜欢
    • 1970-01-01
    • 2015-06-06
    • 2013-02-05
    • 2013-08-19
    • 2018-09-13
    • 2013-09-19
    • 1970-01-01
    • 2012-04-24
    • 2011-02-24
    相关资源
    最近更新 更多