Javascript Minification

Posted by on November 30, 2011 in Javascript, Programming, Web Servers | 0 comments

Javascript is an interpreted language, meaning it’s not pre-compiled.  This has a few drawbacks, like keeping coding logic secret, but it’s good for quick changes and building scripts on the fly using another language.  Compiling is meant to speed up execution.  There is something you can do to speed up execution.  It’s called minification.  It does nothing but make your existing script take up the least amount of space possible.

What it does

  • Speeds up execution of the script slightly.
  • Reducing the physical size of the file.
  • Reduces bandwidth/http requests from the client when you combine scripts.

How it does it

  • Removes all linebreaks and white space
  • Removes all comments
  • Renames variables to shorter names.
You can minify code yourself, but why spend the time when there are tools out there that do it for you.  One great example is jscompress.com
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>