News for hackers. Stuff that matters.
Re:I Turned Off JavaScript for a Week by bojo on Thursday November 19, 2015 @04:03AM (#10593596)
While I understand the intent of your post, don't most people minify (obfuscate) their JS code to reduce bandwidth costs (on both ends, user and company)? Even in todays high bandwidth availability age we still use CDNs and the like to reduce such a cost.

That said, it would definitely be nice to see non-minified versions of code we run in our browsers available as open source by the company serving it. It's not like it's a secret, just a pain to actually try to decipher.

Re:I Turned Off JavaScript for a Week by WorldMaker on Thursday November 19, 2015 @10:47AM (#10595358)
I've been in the habit of leaving sourcemaps in the production drops for this reason that by it's nature it's not exactly secret, even if the code isn't strictly "open source": if someone is that interested in the non-minified version they are likely to use a deminifier anyway and obfuscation isn't security nor copyright law enforcement. Plus it's also selfish and lazy to leave the sourcemaps accessible (thus the business case for it): as much as you work to prevent having to debug things in production, you will almost always need to debug things in production.

Sourcemaps are great.

Re:I Turned Off JavaScript for a Week by iainmerrick on Thursday November 19, 2015 @04:43AM (#10593745)
Gzip encoding works great to shrink JS (and CSS and HTML). Obfuscation adds almost nothing on top of that.

Dead-code stripping is still useful but you can do that without obfuscating.

Re:I Turned Off JavaScript for a Week by z3t4 on Thursday November 19, 2015 @04:49AM (#10593779)
You only save bandwidth the first time the resource is accessed. After that it's loaded from the browser cache! So over time, the band-witch saving by minification is insignificant.
Re:I Turned Off JavaScript for a Week by samspot on Wednesday November 25, 2015 @09:23AM (#10627274)
The first time the resource is accessed is the most important. You have precious few seconds before the user instinctively reaches for the back button.

See http://www.fastcompany.com/1825005/how-one-second-could-cost... and other similar articles.

Re:I Turned Off JavaScript for a Week by simoncion on Thursday November 19, 2015 @05:14AM (#10593901)
So, the answer to bojo's question is "Yes.".

> After that it's loaded from the browser cache!

Unless the resource changes, the UA's cache is cleared, the file is served with incorrect caching headers, the cache expiry time specified in the resource header is reached, the resource is loaded by a UA that doesn't cache...

Re:I Turned Off JavaScript for a Week by z3t4 on Thursday November 19, 2015 @08:29AM (#10594590)
Lets say your .js files takes up 5% of your total app size after gzip compression, and minification saves you around 20%. Then you have saved around 1% bandwidth at the cost of obfuscation and more difficult debugging. And If it's cached, witch all main-steam browsers does, you've saved around 0.01% at best. So if you pay $10,000 in bandwidth costs each month, that's $1 saved :P
Re:I Turned Off JavaScript for a Week by simoncion on Thursday November 19, 2015 @04:12PM (#10597711)
1) I can play the "let's make numbers up" game, too.

2) There are many, many people in the world today who access the internet through what is effectively a 2G connection.

3) "...at the cost of obfuscation and more difficult debugging."

3a) Sometimes obfuscation is a desirable side-effect.

3b) Javascript source maps exist for a reason.

4) "And If it's cached, witch all main-steam browsers does..."

4a) It's almost as if you ignored the majority of the last sentence in my previous comment. :)

Re:I Turned Off JavaScript for a Week by dzhiurgis on Thursday November 19, 2015 @05:34AM (#10593963)
While I do not mind the obfuscation, I do not like that browsers do not give you easy way to access/inspect variables. Or seeing what function names (and parameters) are called.