2015-06-05 110 views
2

我在xpages.I使用字体真棒有一个名为securePolling主题中,我给的链接资源 内securePolling代码字体真棒进行XPages不会生效,即使装载后

<theme extends="webstandard" xmlns:xsi="http://www.w3.org/2001/XMLSchema- instance" xsi:noNamespaceSchemaLocation="platform:/plugin/com.ibm.designer.domino.stylekits/ schema/stylekit.xsd" > 

<resource rendered="#{javascript:context.getProperty('xsp.resources.aggregate').equals('true')}"> 
    <content-type>text/css</content-type> 
    <href>font-awesome-fontFamily.css</href> 
</resource> 
<resource rendered="#{javascript:context.getProperty('xsp.resources.aggregate').equals('true')}"> 
    <content-type>text/css</content-type> 
    <href>font-awesome-4.2.0/font-awesome-4.2.0/css/font-awesome.min.css</href> 
</resource> 

因此font-awesome文件夹位于WebContent文件夹中。下面 是xsp.properties

xsp.ajax.renderwholetree=false 
xsp.application.timeout=30 
xsp.compress.mode=gzip 
xsp.error.page=error.xsp 
xsp.html.page.encoding=utf-8 
xsp.library.depends=com.ibm.xsp.extlib.library 
xsp.persistence.maxviews=16 
xsp.persistence.mode=basic 
xsp.resources.aggregate=false 
xsp.session.timeout=30 
xsp.theme=securePolling.theme 
xsp.upload.maximumsize=10000 

代码这一切操作,我可以在浏览器调试工具检查它显示的是字体awesome.css加载但字体不花费蚂蚁图标后的效果, 这里是更清晰的图像。 marked in red are font-awesome fonts

经过一番研究,也尝试改变字体awesome.css代码

@font-face { 
font-family: "FontAwesome"; 
src: url('font/fontawesome-webfont.eot'); 
src: url('font/fontawesome-webfont.eot?#iefix') format('eot'); 
src: url('font/fontawesome-webfont.woff') format('woff'); 
src: url('font/fontawesome-webfont.ttf') format('truetype'); 
src: url('font/fontawesome-webfont.svg#FontAwesome') format('svg'); 
font-weight: normal; 
font-style: normal; 
} 

任何帮助将非常感激。

当聚合更改为“false”时,它工作得很好,但是当它为“true”时,它不会生效。图像结果和控制台在更改为“true”之后。 result and console after aggregation "true"

回答

2

上述问题背后的实际原因是我在“.css”文件中将字体文件放在字体目录中的路径。

现在从一开始我们就可以看到资源路径为“font-awesome-4.2.0/font-awesome-4.2.0/css/font-awesome.min.css”的“.theme”文件代码“

<resource rendered="#{javascript:context.getProperty('xsp.resources.aggregate').equals('true')}"> 
<content-type>text/css</content-type> 
<href>font-awesome-4.2.0/font-awesome-4.2.0/css/font-awesome.min.css</href> 

根据路径有2个文件夹,然后字体folder.So我已删除一个文件夹,并取得的路径是这样”字体真棒-4.2.0/CSS /字体awesome.min的CSS”。

现在,当我把聚合打开,字体文件夹的路径看起来像这样。这对我有效。

@font-face { 
font-family: "FontAwesome"; 
src: url('font-awesome-4.2.0/font/fontawesome-webfont.eot'); 
src: url('font-awesome-4.2.0/font/fontawesome-webfont.eot?#iefix') format('eot'); 
src: url('font-awesome-4.2.0/font/fontawesome-webfont.woff') format('woff'); 
src: url('font-awesome-4.2.0/font/fontawesome-webfont.ttf') format('truetype'); 
src: url('font-awesome-4.2.0/font/fontawesome-webfont.svg#FontAwesome') format('svg'); 
font-weight: normal; 
font-style: normal; 
} 

当我把聚集离场代码看起来像这样

@font-face { 
font-family: "FontAwesome"; 
src: url('../../font-awesome-4.2.0/font/fontawesome-webfont.eot'); 
src: url('../../font-awesome-4.2.0/font/fontawesome-webfont.eot?#iefix') format('eot'); 
src: url('../../font-awesome-4.2.0/font/fontawesome-webfont.woff') format('woff'); 
src: url('../../font-awesome-4.2.0/font/fontawesome-webfont.ttf') format('truetype'); 
src: url('../../font-awesome-4.2.0/font/fontawesome-webfont.svg#FontAwesome') format('svg'); 
font-weight: normal; 
font-style: normal; 
} 

参考,文件夹结构是现在。

font-awesome folder structure for reference

该解决方案完全解决了我的问题。

+0

Thanx给Brian Gleeson,答案和评论都帮助我解决并完成它。基本上,我没有正确地获取字体文件。 –

3

我认为这应该看起来像下面的CSS。但需要注意,这里的相对URL将只与聚集工作关闭:一个叫“字体”文件夹中的绝对

@font-face { 
    font-family: "FontAwesome"; 
    src: url('../font/fontawesome-webfont.eot'); 
    src: url('../font/fontawesome-webfont.eot?#iefix') format('eot'); 
    src: url('../font/fontawesome-webfont.woff') format('woff'); 
    src: url('../font/fontawesome-webfont.ttf') format('truetype'); 
    src: url('../font/fontawesome-webfont.svg#FontAwesome') format('svg'); 
    font-weight: normal; 
    font-style: normal; 
} 

而且,是吗?通常他们在Font Awesome下载文件夹中名为“fonts”。

随着聚集打开,你需要不同的相对URL:

@font-face { 
    font-family: "FontAwesome"; 
    src: url('../../../font/fontawesome-webfont.eot'); 
    src: url('../../../font/fontawesome-webfont.eot?#iefix') format('eot'); 
    src: url('../../../font/fontawesome-webfont.woff') format('woff'); 
    src: url('../../../font/fontawesome-webfont.ttf') format('truetype'); 
    src: url('../../../font/fontawesome-webfont.svg#FontAwesome') format('svg'); 
    font-weight: normal; 
    font-style: normal; 
} 

所以,你可能要创建的字体真棒CSS文件的两个版本,一个加载时聚集的时候,那当聚合打开时加载。或者有一个版本使用绝对网址而不是相对的网址。

另外要注意的是,字体真棒带有“.css”文件和最小化版本“.min.css”,所以一定要根据需要更改两个版本。

+0

对不起,我删除了评论,因为当我尝试与聚合对它来到同样的问题。 –

+0

在浏览器开发工具的控制台中是否有错误? –

+0

当我把聚合关闭它的作品非常fine.but当其更改为真的行为再次是相同的在上面的图像 –