Most flexible minimizer/compressor for ASP.NET MVC 2?
From your experience, what's the most flexible minimizer/compressor (JS+CSS) for ASP.NET MVC you've dealt with?
So far
- mbcompress doesn't seem to be too MVC friendly
- weboptimizer.codeplex.com lacks documentation
- clientdependency.codeplex.com
is still in beta - compress2 seems like a good candidate, but haven't tried it yet
- mvcscriptmanager only combines and compresses javascript but not CSS
By flexible I mean
- Choose what should be compressed, minified, and comb开发者_JAVA百科ined
- Add exceptions. E.g. if debug don't compress XYZ.JS or don't minify ABC.CSS
- Caching
- In the end, it should help offer the best YSLOW score.
If you know of any other assemblies out there, please list them also.
ClientDependency is not in beta anymore and works well with MVC, I think is a very good candidate. AFAIK it does not use YUI but you can plug your own compressor.
I personally find the C# port of YUI Compressor to be the best of the best when it comes to CSS and JavaScript minification. In the end, though, you're going to have to do the leg work to get a perfect YSLOW score. There's no library that you can just drag and drop and it will magically make your website fast. Look into making a controller for your content and doing the following:
- GZIP your response
- Far Future Expire: HttpResponse.ExpiresAbsolute = DateTime.Now.AddYears(5);
精彩评论