html woff缓存,如何在Wildfly 10中缓存字体(.woff,woff2,.ttf,.eot)?(How to Cache fonts (.woff, woff2, .ttf, .eot)...

如何在Wildfly 10中缓存字体(.woff,woff2,.ttf,.eot)?(How to Cache fonts (.woff, woff2, .ttf, .eot) in Wildfly 10?)

我在我的JSF 2.2项目中使用Primefaces 5.3和Omnifaces 2.3创建字体文件,并且需要将这些文本字体文件(如.woff和.woff2)放在wildfly缓存中,但不幸的是我没有收到。

图像文件(.gif,.png)和CSS文件在缓存中,只有文本字体不在缓存中。

我把这些谓词放在wildlfy中: ... path-suffix [ '.woff2'] or path-suffix [ '.woff2.xhtml'],但我无法获得缓存。

遵循WildFly 10的代码来执行缓存:

独立-full.xml

请帮我解决这个问题。

谢谢。

I have font files within my JSF 2.2 project with Primefaces 5.3 and Omnifaces 2.3 and need to put these text font files (as .woff and .woff2) within the wildfly cache but unfortunately I'm not getting.

Image files (.gif, .png) and CSS files are in the cache, only text fonts that are not in the cache.

I used the tips from this site, but still could not make it work: https://gist.github.com/remibantos/5e86829e1ba6ad64eea1

I put these predicate within the wildlfy: ... path-suffix [ '.woff2'] or path-suffix [ '.woff2.xhtml'], and yet I can not have the cache.

Follows the code WildFly 10 to use to perform the cache:

standalone-full.xml

Please, help me with this problem.

Thx.

原文:https://stackoverflow.com/questions/37062704

更新时间:2019-11-24 10:40

最满意答案

经过一些测试后,我发现问题在于我没有使用ssl。 如果我启用ssl(https),缓存通常会发生。

然后,在我使用http的网站开发过程中,当我需要尝试缓存时,我使用https。

我不知道为什么发生这种情况,但至少想出了如何解决这个问题并继续发展。

真心谢谢你的帮助:)

After some testing, I found that the problem was that I was not using ssl. if I enable ssl (https) the cache usually happens.

Then during the development of the site I'm using http, when I need to experiment with cache I use https.

I do not know why this happens but at least figured out how to solve this problem and continue development.

Thank you truly for all the help :)

相关问答

简而言之,字体很老,但最近才被IE支持。 对于IE9以上的Internet Explorers来说, eot是必需的 - 他们发明了这个规范,但是eot是一种可怕的格式,可以消除大部分的字体特征。 ttf和otf是正常的旧字体,但有些人感到烦恼,这意味着任何人都可以下载并使用它们。 大约在同一时间,iOS在iPhone和iPad上实现了svg字体。 那么, woff被发明了,它有一种模式来阻止人们盗版字体。 这是首选格式。 如果您不想支持IE 8和更低版本,iOS 4及更低版本,以及Android

...

在IIS中,您可以通过将以下内容添加到项目的web.config中来声明WOFF2字体文件的MIME类型:

更新 :mime类型可能会根据最新的W3C

...

经过一些测试后,我发现问题在于我没有使用ssl。 如果我启用ssl(https),缓存通常会发生。 然后,在我使用http的网站开发过程中,当我需要尝试缓存时,我使用https。 我不知道为什么发生这种情况,但至少想出了如何解决这个问题并继续发展。 真心谢谢你的帮助:) After some testing, I found that the problem was that I was not using ssl. if I enable ssl (https) the cache usuall

...

ngx_pagespeed目前不支持延长woff文件的缓存生命周期。 您可以告诉Nginx使用长TTL提供woff文件,或者从ngx_ / mod_pagespeed请求此功能。 ngx_pagespeed does not currently support extending the cache lifetime for woff files. You could tell Nginx to serve woff files with a long TTL or request this fe

...

那么这是一个有趣的问题。 答案是:不,你不应该这样做。 但是原因与你想象的有点不同...... 由于有点神秘的原因,总是要求字体没有证书(基本上是cookies)。 对于大多数浏览器(Edge是例外),这意味着浏览器为该请求打开另一个连接,这很重要,因为HTTP / 2推送链接到连接。 因此,如果您在一个连接上推送资源,并且浏览器从另一个连接获取资源,它将不会使用该推送资源(您不会像您想象的那样直接将其推入HTTP缓存中)。 这和Jake Archibald在他出色的HTTP / 2推送中讨论的许

...

它没有受到伤害,TTF,SVG被广泛使用,EOT根本不受支持。 浏览器应该只加载一个字体文件,而不是全部四个,所以为了支持起见,然后声明它并没有什么坏处。 http://caniuse.com/#feat=ttf http://caniuse.com/#feat=woff http://caniuse.com/#feat=svg http://caniuse.com/#feat=eot It doesn't hurt, TTF, SVG are widely used, EOT is not su

...

解决了! 我分开srcs ,就像那样: @font-face

font-family: "Alef"

src: url("..\..\public\fonts\Alef\Alef-Webfont\Alef-Bold.eot")

src: url("..\..\public\fonts\Alef\Alef-Webfont\Alef-Bold.eot?#iefix") format("embedded-opentype")

src: url("..\..\public

...

有我的字体配置 {

test: /\.(woff|woff2|ttf|eot)$/,

use: 'file?name=fonts/[name].[ext]!static'

}

也许是有用的 - - 添加 - - resolve: {

extensions: ['.js', '.jsx', '.css', '.less', '.json'],

modules: ['node_modules', 'path/to/your/static_resource']

}

t

...

将css-loader与file-loader或url-loader一起使用。 例如: {

module: {

rules: [{

test: /\.css$/,

loader: 'css-loader'

}, {

test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,

loader: 'url-loader',

options: {

limit: 10000

...

通过stylus.url()的源代码阅读,我找到了stylus.url()选项。 我没有在任何地方找到记录。 我可以通过设置该选项来设置我想要base64编码的mime类型: stylus(str)

.set('filename', __dirname + '/css/test.styl')

.define('url', stylus.url({

mimes: {

'.gif': 'image/gif',

'.png'

...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值