Resources Richfaces自定义蒙皮图像

Resources Richfaces自定义蒙皮图像,resources,richfaces,skinning,Resources,Richfaces,Skinning,我的web应用程序对(e)css文件进行了正常蒙皮 我有两张皮: 正常 黑白 颜色很好用 但现在我遇到了以下问题:图像 对于每个皮肤,我想要不同的图像。 我怎么知道?我在任何ECS/蒙皮教程中都找不到。不可能吗 css示例: #header h1 { background-position:0 6px; background-image: url("#{resource['image/header_1.png']}"); } 问题:对于正常皮肤,我希望获得图像:“ima

我的web应用程序对(e)css文件进行了正常蒙皮

我有两张皮:

  • 正常
  • 黑白
颜色很好用

但现在我遇到了以下问题:图像 对于每个皮肤,我想要不同的图像。 我怎么知道?我在任何ECS/蒙皮教程中都找不到。不可能吗

css示例:

#header h1 {
    background-position:0 6px;
    background-image: url("#{resource['image/header_1.png']}");
}
问题:对于正常皮肤,我希望获得图像:“image/header_1.png” 对于黑白皮肤,我想:“image/header_2.png” 我该怎么做呢。任何指点都很好

我应该在资源servlet(或其他什么)中解决它吗? 或者我需要在maven插件中修复它吗?对于这一部分,我了解得更少;-)

pom.xml文件的一部分

<plugin>
        <groupId>org.richfaces.cdk</groupId>
        <artifactId>maven-richfaces-resources-plugin</artifactId>
        <version>4.3.7.Final</version>
        <executions>
          <execution>
            <id>process-resources</id>
            <goals>
              <goal>process</goal>
            </goals>
            <configuration>
              <staticResourceMappingFile>D:\workspace\MyProject\target\classes/META-INF/richfaces/custom-packedcompressed-resource-mappings.properties</staticResourceMappingFile>
              <resourcesOutputDir>D:\workspace\MyProject\target\classes/META-INF/resources/org.richfaces.staticResource/4.3.7.Final/PackedCompressed/</resourcesOutputDir>
              <staticResourcePrefix>org.richfaces.staticResource/4.3.7.Final/PackedCompressed/</staticResourcePrefix>
              <pack>true</pack>
              <compress>true</compress>
              <excludedFiles>
                <exclude>^javax.faces</exclude>
                <exclude>^\Qorg.richfaces.renderkit.html.images.\E.*</exclude>
                <exclude>^\Qorg.richfaces.renderkit.html.iconimages.\E.*</exclude>
                <exclude>^jquery\.js$</exclude>
              </excludedFiles>
              <webRoot>D:\workspace\MyProject/src/main/webapp</webRoot>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.5</version>
            <scope>compile</scope>
          </dependency>
        </dependencies>
        <configuration>
          <skins>
            <skin>normal</skin>
            <skin>blackwhite</skin>
          </skins>
          <excludedFiles>
            <exclude>^\Qorg.richfaces.renderkit.html.images.\E.*</exclude>
            <exclude>^\Qorg.richfaces.renderkit.html.iconimages.\E.*</exclude>
            <exclude>^jquery.js$</exclude>
          </excludedFiles>
          <includedContentTypes>
            <include>application/javascript</include>
            <include>text/css</include>
            <include>image/.+</include>
          </includedContentTypes>
          <fileNameMappings>
            <property>
              <name>^org\.richfaces\.ckeditor/([^/]+\.(png|gif|jpg))$</name>
              <value>org.richfaces.ckeditor.images/$1</value>
            </property>
            <property>
              <name>^org\.richfaces\.ckeditor/([^/]+\.css)$</name>
              <value>org.richfaces.ckeditor.css/$1</value>
            </property>
            <property>
              <name>^org\.richfaces\.ckeditor/([^/]+\.(js))$</name>
              <value>org.richfaces.ckeditor.js/$1</value>
            </property>
            <property>
              <name>^.+/([^/]+\.(png|gif|jpg))$</name>
              <value>org.richfaces.images/$1</value>
            </property>
            <property>
              <name>^.+/([^/]+\.css)$</name>
              <value>org.richfaces.css/$1</value>
            </property>
          </fileNameMappings>
        </configuration>
      </plugin>

org.richfaces.cdk
maven richfaces资源插件
4.3.7.最终版本
过程资源
过程
D:\workspace\MyProject\target\classes/META-INF/richfaces/custom-packedcompressed-resource-mappings.properties
D:\workspace\MyProject\target\classes/META-INF/resources/org.richfaces.staticResource/4.3.7.Final/PackedCompressed/
org.richfaces.staticResource/4.3.7.Final/PackedCompressed/
符合事实的
符合事实的
^javax.faces
^\Qorg.richfaces.renderkit.html.images。\E*
^\Qorg.richfaces.renderkit.html.iconimages。\E*
^jquery\.js$
D:\workspace\MyProject/src/main/webapp
org.slf4j
slf4j简单
1.7.5
编写
典型的
黑白的
^\Qorg.richfaces.renderkit.html.images。\E*
^\Qorg.richfaces.renderkit.html.iconimages。\E*
^jquery.js$
应用程序/javascript
文本/css
图像/+
^org\.richfaces\.ckeditor/([^/]+\(png | gif | jpg))$
org.richfaces.ckeditor.images/$1
^org\.richfaces\.ckeditor/([^/]+\.css)$
org.richfaces.ckeditor.css/$1
^org\.richfaces\.ckeditor/([^/]+\.(js))$
org.richfaces.ckeditor.js/$1
^.+/([^/]+\(png|gif|jpg))$
org.richfaces.images/$1
^.+/([^/]+\.css)$
org.richfaces.css/$1

解决方案并不复杂,但并不令人满意

我已将资源文件的引用移动到蒙皮属性文件:

custom.ecss:

...
.btn-accept{
    height:22px;
    width:47px;
    background: '#{richSkin.okBtnImg}';
}
...
....
okBtnImg=url("#{resource['image/button/okBtnImg.png']}") no-repeat 0 0 !important;
...
....
okBtnImg=url("#{resource['image/customSkin/button/okBtnImg.png']}") no-repeat 0 0 !important;
...
default.skin.properties:

...
.btn-accept{
    height:22px;
    width:47px;
    background: '#{richSkin.okBtnImg}';
}
...
....
okBtnImg=url("#{resource['image/button/okBtnImg.png']}") no-repeat 0 0 !important;
...
....
okBtnImg=url("#{resource['image/customSkin/button/okBtnImg.png']}") no-repeat 0 0 !important;
...
custom.skin.properties:

...
.btn-accept{
    height:22px;
    width:47px;
    background: '#{richSkin.okBtnImg}';
}
...
....
okBtnImg=url("#{resource['image/button/okBtnImg.png']}") no-repeat 0 0 !important;
...
....
okBtnImg=url("#{resource['image/customSkin/button/okBtnImg.png']}") no-repeat 0 0 !important;
...

我已经创建了多租户网站,每个租户可以在标题中设置不同的皮肤和徽标。为了显示不同租户的不同图像,我使用了图像servlet。Servlet分析会话中的属性,从数据库中选择图像(基于参数),并将图像放入响应。此解决方案在生产过程中可正常工作约2年。你可以试着做类似的事情。Thx对于@VasilLukach的想法,我会记住的