What are some good css and js minimizers for production code? [closed]

核能气质少年 提交于 2019-11-26 22:20:25

问题


I'm looking for some applications or websites that minimize css and js files. Ideally, they could batch them all or if not, one at a time.


回答1:


YUI Compressor does both JavaScript and CSS. I'm not sure if you can send it a batch of files.

You can batch process at YUI Compressor Online (yui.2clics.net), though that version only accepts JavaScript. Another Online YUI Compressor (refresh-sf.com) accepts CSS, too, but doesn't batch.

In terms of comparing the various minifiers, see jQuery : Frequently Asked Questions (FAQ) : How do I compress my code? Also, check out Microsoft Ajax Minifier.

jQuery has switched from the YUI Compressor to Google's Closure Compiler for the minified version that they distribute.




回答2:


YUI Compressor is pretty cool. You can run it as part of a build process from the command line




回答3:


Take a look at The JavaScript CompressorRater. It does live comparisons of various minifiers (with and without gzip compression) for any JavaScript you supply it.

It also (mostly) works with CSS, though not all minifiers support it and not even all of those that do (e.g. YUI) show up correctly in the comparison table.




回答4:


Microsoft released their Microsoft Ajax Minifier on codeplex today. Includes an MS build task and everthing inside VS 2005/2008




回答5:


I like this one from Yahoo: http://developer.yahoo.com/yui/compressor/




回答6:


I use Packer by Dean Edwards for javascript.




回答7:


There's also a .NET port of YUI Compressor which allows you to:-

  • intergrate the minification/file combining into Visual Studio post-build events
  • intergrate into a TFS Build (including CI)
  • if you wish to just use the dll's in your own code (eg. on the fly minification).



回答8:


Basically what you are looking is to speed up your site by reducing the size of the response.

The other thing apart from minified js and css files is you can do a http compress. Please go through this and this.




回答9:


If you don't mind using Perl as part of your build process, JavaScript:: and CSS::Minifier work pretty well.




回答10:


you can try the free tools from Boryi




回答11:


Or try this: http://www.codeproject.com/KB/aspnet/CombineAndMinify.aspx




回答12:


YUI compressor is great.

Another tool (and my weapon of choice due to its PHP-ness) is the PHP5-based Minify project hosted on Google code. If you're on a PHP platform consider it. Rather than running your stuff through a service after the fact, you install and configure this on your webserver once and then code and comment as much as you want and minify will rebuild (reminify) your CSS and/or Javascript on the fly. Yeah. I've used it, works great!!

http://code.google.com/p/minify/



来源:https://stackoverflow.com/questions/702907/what-are-some-good-css-and-js-minimizers-for-production-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!