views:

85

answers:

3

Hey I am working on a big .NET project. I am currently creating an automated minifier for JS and CSS files using YUI compressor. After doing some research, I found that the heaviest files in the project are actually .NET resources (Like MS ajax file). They are very big and unminified.

I am wondering, is there any way to minify them?

Thanks

A: 

I have created a minifier for Markup. It is logical that the bulk of all output is typically contained in markup opposed to requested data assets.
http://mailmarkup.org/prettydiff/markupmin.js

My code is written in JavaScript, so it would have be logically reconstructed into ASP logic, if you are using ASP. I have also updated the logic to be more precise in remove whitespace characters. I will upload the updated code as soon as I can access a personal internet connection. The update removes the single space characters that exists in output between two start tags or two end tags. Single space characters that exist before and/or after singleton tags remain in output.

My code properly ignores whitespace in ASP and PHP tags, so there will likely exist an efficiency hole not convered by my code, but easily correctly be supplying additional logic to account of syntax considerations of ASP or PHP languages.

If this code is of some assistance, but not entirely what you need I can make alterations.

A: 

Are you trying to compress JavaScript or any other type of files?

If you are looking forward to compress JavaScript files, you can actually go ahead and compress ASP.NET AJAX libraries as well. This is a standard practice and most large JS libraries are compressed prior to deployment.

hitec
A: 

Yep - there's definitely a way to minify and/or combine any Javascript and/or Cascading Style Sheets for your ASP.NET application.

But before I drop some links, etc... if you're using some of the major javascript framework's, like jQuery, MSAjax, whatever.. they all usually have minified version available to download .. and some of them are available on CDN's .. which means you don't need to minify/combine them in your solution.

Here is a list of major javascript libraries cached on the MS CDN.

Now, finally for some info about how to minify/combine ASP.NET solutions.

This link has some documentation about how to make an MSBuild.xml file which is used to defines all the configuration settings/options for YUICompressor.NET.

While this link is a video I made about how to do this with TFS2008 and Continuous Integration.

HTH.

Pure.Krome