Saturday, January 13. 2007
Comments
Display comments as
(Linear | Threaded)
Once you start deploying large amounts of JavaScript on various browsers you'll hit bugs. Its not that compressing breaks the code (though some packers can) its that you can't useful error messages when your code is packed to a single line. So every JavaScript errors happens on line 1.
Hi Joshua
I'm glad you got the trackback. For some reason it didn't want to send on the first try so if you got it twice I apologise.
The difference between whether to compact js or not may just be a question of experience with large projects then. As I said my experience with javascript is fairly limited so these types of errors may be something I still have to look forward to.
I'm glad you got the trackback. For some reason it didn't want to send on the first try so if you got it twice I apologise.
The difference between whether to compact js or not may just be a question of experience with large projects then. As I said my experience with javascript is fairly limited so these types of errors may be something I still have to look forward to.
Besides project size, I think the other factor in compacting code is how your using JavaScript. If your building a JavaScript app you end up have a lot more logic built in JavaScript and its that type of code that tends to hit more bugs.
Maybe you don't handle a failed AJAX request correctly, or the new version of IE has some slight API changes in seldom used code. But really its a tradeoff, code size against good bug reports, a lot of times good bug reports don't matter since people aren't going to send anything in anyway.
I tend to strip out comments and extra whitespace, but I don't do a full compact.
Maybe you don't handle a failed AJAX request correctly, or the new version of IE has some slight API changes in seldom used code. But really its a tradeoff, code size against good bug reports, a lot of times good bug reports don't matter since people aren't going to send anything in anyway.
I tend to strip out comments and extra whitespace, but I don't do a full compact.
The author does not allow comments to this entry

I recently commented on a post from Joshua Eichorn looking at caching javascript files. In the post he highlights the savings that can be made in terms of bandwidth. What can you do though if you want to prevent javascript from caching? The php manua
Tracked: Jan 26, 14:29