我有一个网站,我想在其中压缩大型svg图标spritesheet。在startup.cs中,我的ConifgureServices方法中包含以下内容
services.AddResponseCompression(options =>
{
options.Providers.Add<GzipCompressionProvider>();
options.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(new[] {"image/svg+xml"});
});
services.Configure<GzipCompressionProviderOptions>(options =>
{
options.Level = CompressionLevel.Optimal;
});
在“配置”中,我有
app.UseResponseCompression();
app.UseStaticFiles(new StaticFileOptions
{
OnPrepareResponse = ctx =>
{
ctx.Context.Response.Headers[HeaderNames.CacheControl] = "public, max-age=31536000, immutable";
ctx.Context.Response.Headers[HeaderNames.Vary] = new[] { "Accept-Encoding" };
ctx.Context.Response.Headers["Keep-Alive"] = new[] { "timeout=5, max=100" };
}
});
其他文件已压缩,但SVG未压缩。为什么会这样?