How Javascript Minification Works

Published: 30 June 2014
on channel: Techy Help
600
like

Do you know how Javascript minification works?

A little. Minification is the cutesy term for minimizing code by removing all unnecessary characters.

Kind of like texting does today.

No, a lot more logical and reasonable than most texting conversations. Minification removes the characters without, hopefully, altering its functionality.

Why go to all the work to minimize the code? It certainly is not for programmer productivity.

Removing all the white spaces you can, new line characters and comments means the data transferred to run the JavaScript code is reduced.

Why do you need to worry about transferring the data?

Unless you're accessing a server side application from a terminal, the JavaScript code is sent as a file that the user downloads along with the webpages. Minification eliminates a lot of unneeded characters, so the file is smaller.

Then it runs faster.

That's the intent. Then again, with a webpage, minimized code can improve web pages because the size of the page is reduced.

And there's tons of data on how many people won't even bother to scroll to the bottom of a web page to see what's there.

The intent is closer to creating a smaller web page so that people don't abandon it because it takes so long to load.

It sounds a lot like data compression.

No, because data compression requires un-compression. Minimized code doesn't need to be decompressed and runs the same through the interpreter as un-minimized code.

Except more quickly.

Well, there's that.

It still seems like a lot of work when there are so many people with T1 and other high speed internet connections.

A minimized website with faster page load times are appreciated by those who pay data rates while using a mobile device to surf the web. And smaller files result in faster file requests, no matter what device you use.

A leaner, meaner web page is the result of minimization then.

Minification, minimization, lean web design -- same difference.


Watch video How Javascript Minification Works online without registration, duration hours minute second in high quality. This video was added by user Techy Help 30 June 2014, don't forget to share it with your friends and acquaintances, it has been viewed on our site 600 once and liked it like people.