Erm... so you're saying we should go and turn this:
if(fooBar) { var baz = false; var x = 0; while(!baz) { if(x == 260) { baz = true; } if(x == 25) { runThis({ a: 'b', c: 'd' }); } x++; } if(x > 55) andRunThis(fooBar); }
Into this:
if(fooBar){ var baz=false; var x=0; while(!baz){ if(x==260){ baz=true; } if(x==25){ runThis({ a:'b', c:'d' }); } x++; } if(x>55) andRunThis(fooBar); }
Minification killing debugging isn't just because of it destroying newlines. I honestly don't want to pop between places to debug things. Do remember that some of us like to debug within the browser. FireFox with FireBug for one very nicely lets me jump to where an error happened in the code and breakpoint it as well. Trying to do that with a mess like that even if you don't touch newlines is still troublesome to read. You can hardly tell where something starts and where something ends. But not only that, plenty of the optimization that comes from minification is because it completely removes comments. There's little point to minifying if you're only going to minify half way. You get the worst of both worlds. Hard to read code, and your filesize still hasn't changed much.
~Daniel Friesen (Dantman, Nadir-Seen-Fire) ~Profile/Portfolio: http://nadir-seen-fire.com -The Nadir-Point Group (http://nadir-point.com) --It's Wiki-Tools subgroup (http://wiki-tools.com) --The ElectronicMe project (http://electronic-me.org) -Wikia ACG on Wikia.com (http://wikia.com/wiki/Wikia_ACG) --Animepedia (http://anime.wikia.com) --Narutopedia (http://naruto.wikia.com)
Aryeh Gregor wrote:
On Fri, Dec 12, 2008 at 7:31 PM, Michael Dale mdale@wikimedia.org wrote:
We would have the script_server be passed a unique variable per SVN version of the mediaWiki (like we currently do with the static js includes) If their browser treats a new url with different get parameters as the same as some older version resulting in a cache mismatch then that is bad...
Ideally we don't have broken transformations on our back end per our unique urls matched to the svn version of the file. Yes different output of js means different input for the client and yes different input could result in new unforeseen errors client side that don't manifest in the un-minimized code. We would of course want to do lots of testing with the minimized output.
Or we could just do ordinary minification, but not touch newlines (including ones that are part of comments). The benefit for debugging seems to outweigh the very marginal incremental improvements to page load time.