

An Argument Against JavaScript Minification - soofaloofa
http://blog.kevinsookocheff.com/an-argument-against-javascript-minification

======
jdietrich
Minification is _vital_. It has been widely reported that an extra 100ms in
latency costs Amazon 1% of their sales. Google found that 500ms of extra
latency reduced traffic by 20%. Optimising page load time is one of the
cheapest and simplest ways of improving user experience and so your business.

Sacrificing profits and UX for a few hypothetical developers is lunacy. If you
really want to share the wealth and let newbie developers read your source,
blog about it or submit it to Github - then you can include explanation of
your design and make it far easier for them to get the interesting bits.

~~~
benologist
When you're not relying on 200k of external libraries minification is a lot
less significant.

When you enable GZIP it's even less so.

~~~
runningdogx
Minification still offers a substantial savings. The following file size stats
are from jquery 1.6.0 just now pulled from google's urls:

Uncompressed (normal:minified) 232651:90518

Gzip -6 (normal:minified) 66778:31610

Gzip -1 (normal:minified): 81986:36633

gzip -9 only saves a few hundred bytes on each vs default compression level of
6.

bzip2 and xz do not achieve dramatic reductions of the readable jquery code
either; the normal:minified ratio is slightly improved, but is still approx.
2:1.

------
marcusbooster
This sounds more like an argument for open source. Ignoring efficiency issues,
I'd much rather view a JavaScript framework on GitHub than in a View Source
window.

------
wccrawford
If you want to share your code with others, open source it. There's no need to
not-minify it so they can see it.

I don't see this an an anti-minification argument at all. Instead, it's an
argument for open source in disguise.

~~~
mikey_p
Absolutely. While I'm more on the 'information wants to be free' side of
things, I'm not sure what the ethics are of borrowing from some other sites
JS. If it's really just to learn then fine, but how much copy/paste before
you're in need of a license?

~~~
wccrawford
Copy and paste? Any! Learning from the code is one thing, but just taking it
is wrong and illegal.

------
kilian
Here's how I do it: minified versions are used in the site, if someone wants
to see my code, they can remove the "min" part:

used on site: <http://laserey.es/media/javascripts/base.min.js>

non-minified: <http://laserey.es/media/javascripts/base.js>

------
phaylon
People "learning" by copying, coupled with large popularity, are what gave
JavaScript, PHP and Perl such bad reputations. There are tutorials for most of
the things newcomers might want to do in JavaScript. As such, I wouldn't place
much value in people copying my work when deciding if minification is
necessary.

I assume we're talking about individual per-site code here, since they can
always download non-minified versions of commonly served frameworks easily
somewhere else.

~~~
soofaloofa
This learning by copying are what _made_ JavaScript, PHP, and Perl so popular.

~~~
bcrescimanno
Popularity is not the only success-factor to consider regarding programming
languages. I'd contend that the ubiquity of javascript makes certain that it
will retain (and grow) popularity for quite some time even without the easy
"view source" option.

We're simply moving from one era into another; nothing wrong with progress!

------
lyime
This is an easy problem to solve.

Include paths to the original JS files (un-minified) at the top of the
minified JS file as comments.

------
tszming
Some modern compressors such as YUI Compressor use real JS engine to parse
your script and therefore can detect syntax error during minification, I can't
see any reason why not using it.

------
yuhong
I remember FSF's "free" JS campaign, and it basically comes down to something
like this.

------
nicetryguy
prettyprinter.de

