Friday, September 11, 2009

Javascript minify consern

Minify Javascript/CSS/HTML/XML file to make it smaller in size and fast download.

In the most recent days, I was dealing with big JavaScript code and using DotNetNuke that also use quite large JS file. I realize, it will eat my bandwidth but I just let it happened until I use jQuery. Downloading and using jquery.min.js realizing to make all my js file minified.

Before this I found JS file that minified but that time I am not realizing it will save file size about half of it. The term minify, minifying or minified is for JS with removed whitespace and comment.

I am interested with this kind of ways and here is my reading so far:

Combine, minify and compress JavaScript files to load ASP.NET pages faster
Automatically minify and combine JavaScript in Visual Studio
Optimize WebResource.axd and ScriptResource.axd

There is so many tools out there but I want to implement it either pre-minified or automatically at runtime and combined with exception and disable when debugging in my ASP.NET application based on my options. Based on my readings, I can't find the best tool or code that implement both in one solution to make easier for developer like me.

I just have an idea to create new SourceForge project that will grab all the idea and put it into one solution.

Moreover I wanted to have this features also:
- There is a standalone GUI/command line tools to minify and/or compress included.
- The tools can be integrated to popular SDK like VisualStudio to minify and/or compress during compilation.
- Option to combine all JS files into one or not.
- Option to include or exclude one or a few JS files in the combination (Sometimes we need to seperate the JS files rather than combine it all and put in the header and make page loading later even JS script downloading become faster).
- Option to include or exclude one or a few JS files to be minify and/or compress (because maybe we want to debug one of the JS file).
- Option to disable when debugging.
- Put the minifier and compressor engine in seperate library for easier upgrade either this tool or the engine.
- * the best thing * One simple step just to add http handler or module to minify and/or compress on the fly each JS files and no need to modify anything.
- Support a few more MIME type like JS, CSS, html and xml.

No comments:

Post a Comment