I don't. Trying to hide client-side Javascript code is like trying to hide XHTML: futile. Since your program must be transferred in whole, to be read in text form by the client, there is no way you can hide it from the user.
As with markup code, you may save a kilobyte or two by compacting whitespace, but the payoff isn't really worth the effort.
Triexa.com posted this at 01:50 — 6th November 2006.
Abhishek Reddy;210033 wrote: I don't. Trying to hide client-side Javascript code is like trying to hide XHTML: futile. Since your program must be transferred in whole, to be read in text form by the client, there is no way you can hide it from the user.
As with markup code, you may save a kilobyte or two by compacting whitespace, but the payoff isn't really worth the effort.
I compacted the prototype from 60 to 40KB. That's 20kb every non-cached request. You can't possible sit there and tell me that's pointless savings.
Triexa.com;210035 wrote: I compacted the prototype from 60 to 40KB. That's 20kb every non-cached request. You can't possible sit there and tell me that's pointless savings.
20kB isn't much of a savings, imo, not when you're satisfied with 40kB scripts. Why do you have 20kB of whitespace anyway? And a 40-60kB script?
I'd use a regular expression replacement to delete whitespace, if there was that much. No need for any extra tools.
Triexa.com posted this at 03:13 — 6th November 2006.
I have seen programs before that shrink source code by not only eliminating whitespace, but also by replacing all variable names with 2 letter ones. Yes the final code is confusing to read, but that is why you keep the original. Some sites, every singe byte saved can count.
-Greg
Triexa.com posted this at 19:26 — 6th November 2006.
Greg K;210062 wrote: I have seen programs before that shrink source code by not only eliminating whitespace, but also by replacing all variable names with 2 letter ones. Yes the final code is confusing to read, but that is why you keep the original. Some sites, every singe byte saved can count.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.
Abhishek Reddy posted this at 01:40 — 6th November 2006.
He has: 3,348 posts
Joined: Jul 2001
I don't. Trying to hide client-side Javascript code is like trying to hide XHTML: futile. Since your program must be transferred in whole, to be read in text form by the client, there is no way you can hide it from the user.
As with markup code, you may save a kilobyte or two by compacting whitespace, but the payoff isn't really worth the effort.
Triexa.com posted this at 01:50 — 6th November 2006.
They have: 173 posts
Joined: Feb 2005
I compacted the prototype from 60 to 40KB. That's 20kb every non-cached request. You can't possible sit there and tell me that's pointless savings.
SonicMailer Pro - Professional mailing list manager & award-winning email marketing software
Download a FREE 30-day trial today!
Use coupon savemoreon4 and save 10%!
Abhishek Reddy posted this at 02:55 — 6th November 2006.
He has: 3,348 posts
Joined: Jul 2001
20kB isn't much of a savings, imo, not when you're satisfied with 40kB scripts. Why do you have 20kB of whitespace anyway? And a 40-60kB script?
I'd use a regular expression replacement to delete whitespace, if there was that much. No need for any extra tools.
Triexa.com posted this at 03:13 — 6th November 2006.
They have: 173 posts
Joined: Feb 2005
umm its protoype, WELL known javascript framework. It happens to be that size of a file.
Abhishek Reddy posted this at 03:30 — 6th November 2006.
He has: 3,348 posts
Joined: Jul 2001
Oh right. Might be an idea to capitalise proper nouns to avoid confusion in future.
Greg K posted this at 14:15 — 6th November 2006.
He has: 2,145 posts
Joined: Nov 2003
I have seen programs before that shrink source code by not only eliminating whitespace, but also by replacing all variable names with 2 letter ones. Yes the final code is confusing to read, but that is why you keep the original. Some sites, every singe byte saved can count.
-Greg
Triexa.com posted this at 19:26 — 6th November 2006.
They have: 173 posts
Joined: Feb 2005
Are you able to point to any that do this?
SonicMailer Pro - Professional mailing list manager & award-winning email marketing software
Download a FREE 30-day trial today!
Use coupon savemoreon4 and save 10%!
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.