[Javascript] external scripts

Hakan Magnusson hakan at backbase.com
Mon Jun 21 11:24:34 CDT 2004


Mike,

We have a JavaScript "munger" that apart from obfuscating the code 
beyond human readability also changes all names (variables, functions 
etc) to the smallest possible size (turning sFirstName into XA for 
example) and strips out whitespace, comments and newlines, thus removing 
50-80% of the file size. Since this is our own product I can't give it 
to you, or even let you peak at the code.

Sad to report that I can't find any software that does all this out 
there today, you should still have a look at
http://www.quadhead.de/
for something that is getting close, at least.

Regards,
H


Mike Dougherty wrote:
> I have a client-side browser app composed of about 20 external scripts 
> totalling about 90k
> 
> I viewed this site over dial-up and realized there has to be some 
> optimization to make the site more palatable for dial-up (and 
> consequently improve performance on broadband too)
> 
> I'm guessing a single monolithic script file would be retrieved and 
> cached by the browser more efficiently than 20 separate files - is this 
> a correct assumption?
> 
> I also have inline comments in the script- these are useful for whatever 
> developer go back to the source for upgrades, but serve only to bulk up 
> the download for the customer. 
> Since I'm going to collect these 20+ separate scripts into a single 
> download anyway, I plan to remove the comments too.  Can someone provide 
> me with the regexp to remove everything between /* and */?  (the / needs 
> to be escaped, and isn't the * a wildcard?  i really don't "get" regexp 
> like i want to)
> 
> What is the 'best practice' for maintaining readible source code for 
> developer use and pseudo-compiled script for browser consumption?
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 
> 



More information about the Javascript mailing list