[aklug] Removing newlines from minified javascript

From: Tim Johnson <tim@akwebsoft.com>
Date: Tue Aug 07 2012 - 10:32:43 AKDT

Howdy Folks :
I posted the following question at
http://www.webdeveloper.com/forum/showthread.php?t=263215
###
I've downloaded the source for jsmin and built it on a OSX 10.7 box.

I first process my code with jslint (the Crockford app). I then process
with jsmin to creatify a compacted javascript file. jsmin does not remove newlines ('\n').
The reason, as I understand it, is because
the javascript interpreter automatically inserts semi-colons at line ends, if not found.
An example of such a problem can be found at
http://stackoverflow.com/questions/7...n-if-condition
However, jslint (which does not hurt my feelings) insists on semicolons at ends
of lines (so much as I can see, as I am just learning to use it).

It follows therefore, that if one first determines that the javascript source
file is given the okay from jslint, then it should be safe to remove newlines or replace them with spaces.
1)Am I correct?
2)Will removing newlines really speed up performance all that much?
###
And got no responses.

I realize that there are many minnifiers out there and that many do
remove all newlines (at least, I think so).

However what I like about jsmin is
1)Easy to build on linux or mac.
2)Can be used by command line and from another custom script.
3)Author is same author as jslint

I'd welcome any comments from this LUG. One may say, try it and see
what happens. The problem is that there are sssooo many browsers out
there, thus my interest in comments from other coders.

thanks

-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Tue Aug 7 10:32:52 2012

This archive was generated by hypermail 2.1.8 : Tue Aug 07 2012 - 10:32:52 AKDT