开发者

how to both Compress and Minify content together?

开发者 https://www.devze.com 2023-01-04 19:02 出处:网络
i know we can compress response by declaring Response.Filter as GZip or Delfalte streams, but how i can perform both compression and minification together? declarin开发者_运维问答g new class that inhe

i know we can compress response by declaring Response.Filter as GZip or Delfalte streams, but how i can perform both compression and minification together? declarin开发者_运维问答g new class that inherits Stream, then first performing minify on content, then compress that by GZip or Deflate depending on User-Agent supported each?


For javascript & css files, you can minify them using Microsoft Ajax Minifier 4.0.
You can also use Microsoft Ajax Minifier as a Build Task.

For response compression, you are on the right way, you can use Response.Filter and use either GZip or Delfalte streams.
For a sample code for using Response.Filter, refer to the following article Combining, Compressing, Minifying ASP.NET ScriptResource and HTML Markups.

Also, you can use IIS to compress content.

  • IIS6 Compression
  • IIS7 Compression


hm... 2 days and nothing. check out Mads Kristensen approach http://madskristensen.net/post/A-whitespace-removal-HTTP-module-for-ASPNET-20.aspx. however this isn't exactly that i want but is better than nothing ;)

0

精彩评论

暂无评论...
验证码 换一张
取 消