Minification (programming)

From Seo Wiki - Search Engine Optimization and Programming Languages

Jump to: navigation, search

Minification (very often just minify, and sometimes also minimisation or minimization), in computer programming languages and especially JavaScript, is the process of removing all unnecessary characters from source code, without changing its functionality. These unnecessary characters usually include white space characters, new line characters, comments and sometimes block delimiters; which are used to add readability to the code, but are not required for it to execute.

Minified source code is especially useful for interpreted languages deployed and transmitted on the Internet (such as JavaScript), because it reduces the amount of data that needs to be transferred. Minified source code may also be used as a kind of obfuscation. In Perl culture, aiming at extremely minified source code is the purpose of Perl golf game.

Minified source code is also very useful for HTML code. All white space in HTML is reduced to only one space on the surface of a web page, so it's often quite possible to halve the size of a web page, by removing all excessive white space.



Reputed JavaScript optimizers such as JSMin and Packer, themselves programmed in JavaScript, are specially designed for modern web programming techniques, and are able to understand and preserve conditional comments, and similar. Packer, for instance can optionally Base62 compress the given source code in a manner that can be decompressed by regular web browsers, shrink variable names that are typically 5-10 characters to single letters, reducing the file size of the script, and therefore making it download faster.[1] Google has released their Closure Compiler which also provides minification as well as the ability to introduce more aggressive renaming, removing dead code, and providing function inlining. Certain online tools, such as the Yahoo! UI Compressor also compress CSS files.

Web Development

Listed below are certain Web Development components, that can be built into websites. These optimize and quicken page load times by reducing the size of various files. Content encoding is an approach taken by compatible web servers and modern web browsers to compress HTML and related textual content, often in the gzip format.

  • JavaScript Optimizer - easy management of JavaScript and CSS resources and to reduce the amount of data transferred between the server and the client.
  • pack:tag (Documentation) - A JSP Taglib for minifying JavaScript and CSS on the fly, with caching, combination and compressing.
  • JAWR - A library for Java web applications that joins javascript files and then minifies and compresses them, fostering a modular approach to development. Its main benefit is that developers can switch from the joined, compressed form to separate and uncompressed versions of the scripts, whithout the need to change the pages.
  • Minify - A PHP library that combines, minifies, and caches JavaScript and CSS files on the fly.
  • ShrinkSafe, from the Dojo toolkit.


  1. Packer version 3.0 feature list

See also

Personal tools

Served in 0.064 secs.