How to organize minification and packaging of css and js files to speed up website?

前端 未结 11 1102
独厮守ぢ
独厮守ぢ 2020-12-28 19:41

I am doing speed optimization for my website application. And I found some practises to do that. For example Best Practices for Speeding Up Your Web Site from Yahoo. Among t

相关标签:
11条回答
  • 2020-12-28 20:19

    According to the JavaScript Compression Rater, the most efficient tool is the YUI Compressor or JSMin.

    0 讨论(0)
  • 2020-12-28 20:23

    For compressing everything before uploading it to web, this program is great both for CSS/JS/HTML:

    http://www.w3compiler.com/

    It's even possible to select areas not to compress, as it's not all MVC codes in your markup that supports getting compressed.

    And it saves backup files each time it compress your files, so you can easily decompress it with just a click.

    0 讨论(0)
  • 2020-12-28 20:24

    I wrote my own custom manager for this. It uses google's closure compiler and compresses files only when needed in release mode. Check it out:

    http://www.picnet.com.au/blogs/Guido/post/2009/12/10/Javascript-runtime-compilation-using-AspNet-and-Googles-Closure-Compiler.aspx

    Thanks

    Guido Tapia

    0 讨论(0)
  • 2020-12-28 20:25

    Big fan of Dean Edwards /packer/ myself - comes in a variety of flavours.

    0 讨论(0)
  • 2020-12-28 20:28

    I do ASP.NET, so I use CruiseControl.NET with NAnt for my build process. A part of this build process is compressing with YUICompressor which in my experience is the best compressor out there.

    If you don't do ASP.NET, theres still the original CruiseControl with Ant that you can use in the same capacity.

    The reason I find this a superior set up is because a) all the tedious stuff is automated and b) if you're testing on your own machine you dont have to debug a single super long string of JS :)

    0 讨论(0)
  • 2020-12-28 20:30

    Or you could just configure your HTTP server to GZIP compress all text documents.

    0 讨论(0)
提交回复
热议问题