Over the weekend, I dug up an ASP.NET article I wrote a while ago and never put up anywhere. It was actually meant as a practical example of using HttpHandlers -
which I've talked about before. Basically, the idea is to store of JavaScript into a store (I use XML). Have the JavaScript grouped up into like functionality, such as "Tabbing", "BrowserDetection", "MouseOver", etc. The a page developer simply says, "I need Tabbing on this page", ala JavaScript.EmitJavascript(JavascriptType.Tabbing, JavascriptType.BrowserDetection);
What's really cool about the article is that is uses Dean Edward's Javascript packer. So blocks of JavaScript are obfuscated on the fly (and cached). That means that in development you're dealing with easy-to-read JavaScript, but in production it's compact code.
For example, if you put the HUGE atlas.js (239Kb) file through it, it'll come out at just about 1/2 the size (roughly 123kb). That's insane!
You can
read the article here.
Technorati Tags: JavaScript, .NET