Kent Feiler said:
Using the same technique in Javascript though,
has the serious disadvantage that all your wonderful Doc has to be
downloaded and adds to the page loading overhead. So...I was
wondering how you all handle that situation.
I actually have 3 versions of each script that I have which I put up on my
website.
I have a local version which is liberally commented and has a lot of debug
statements and "assert" kind of statements.
After development is done and I've tested, I run a script which removes all
the debug code and any debug comments, which I mark with //DEBUG:
Then I upload to my website, and I have code like what you see at:
http://www.mattkruse.com/javascript/dynamicoptionlist/source.html
This is full code, commented, and with documentation included in the source
file. This is meant for learning the interface and seeing how the code
works. In this example, the code is 24k - fairly hefty. Once a person is
familiar with the library and is ready to include it into their working
site, they download and use the "compact" version of the code:
http://www.mattkruse.com/javascript/dynamicoptionlist/compact_source.html .
This has comments and whitespace removed, and is better for using in the
real-world situation where reducing js file size might be important because
it is _half_ the size.
I use a perl script which I wrote to do this. It's a messy hack, but it
works. In my local testing, I test with the compact version of the code to
make sure that nothing has been broken during the compression.
There are scripts and utilities out there to compress javascript by removing
whitespace and such - some searching will surely find one that fits your
needs.