在firebase上使用gzip压缩 [英] Compress with gzip on firebase

查看:242
本文介绍了在firebase上使用gzip压缩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的firebase托管网站上压缩我的.css和.js以提高加载速度,但是我无法使用firebase.json配置文件为我的资产正确设置gzip压缩。 / p>

curl -v 命令显示从服务器提供文件时不执行压缩。还在Firefox Developer edition的网络部分进行了检查。



由于我的.json配置,我能够走得最远的是我的浏览器出现加载错误。

 source:** / *。@(jpg | jpeg | gif | png),
标题:[
{
key:Cache-Control,
value:max-age = 7200
},
{
key:Content-Encoding,
value:gzip
}
]

这是我对firebase设置的尝试,导致浏览器没有加载任何css和js。



Any buts?



谢谢!

解决方案

Firebase Hosting有压缩文件的大小阈值。



所有未压缩的文件都很小(<1K),因此它们不符合该阈值。


I'm trying to compress my .css and .js on my firebase hosted web to increase loading speeds, however I've been unable to use the firebase.json config file to correctly setup a gzip compression for my assets.

The curl -v command shows that no compression is performed when serving the files from the server. Also checked in the network section of Firefox Developer edition.

The furthest I've been able to go has been a load error on my browser because of my .json configuration.

"source": "**/*.@(jpg|jpeg|gif|png)",
"headers": [
  {
    "key": "Cache-Control",
    "value": "max-age=7200"
  },
  {
    "key": "Content-Encoding",
    "value": "gzip"
  }
]

This has been my try on the firebase settings resulting in the browser not loading any of the css nor the js.

Any thoughs?

Thanks!

解决方案

Firebase Hosting has a size threshold for compressing files.

All the files that were uncompressed were small (<1K), so they didn't meet that threshold.

这篇关于在firebase上使用gzip压缩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆