Minification (programming)

Minification (programming)

Minification (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 the 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.

Minification can be distinguished from the more general concept of data compression in that the minified source can be interpreted immediately without the need for an uncompression step: the same interpreter can work with both the original as well as with the minified source.

Contents

Types

Tools

JavaScript optimizers such as JSMin and Packer are specially designed for modern web programming techniques, and are able to understand and preserve conditional comments, and similar. Packer, for instance, can optionally Base64 compress the given source code in a manner that can be decompressed by regular web browsers, as well as shrink variable names that are typically 5–10 characters to single letters, which reduces the file size of the script and, therefore, makes 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.[citation needed] In addition, certain online tools, such as the Yahoo! YUI Compressor or Pretty Diff, can compress CSS files.[citation needed]

Web development

Components and libraries for Web applications and websites have been developed to optimize file requests and quicken page load times by reducing the size of various files.

JavaScript and CSS resources may be minified, preserving their behavior while considerably reducing their file size. Libraries such as JavaScript Optimizer are capable of such on-the-fly optimizations.[citation needed]

Some libraries also merge multiple script files into a single file for client download. This fosters a modular approach to development.[citation needed]

A novel approach to server-side minification is taken by Ziproxy, a forwarding, non-caching, compressing HTTP proxy targeted for traffic optimization. It minifies and optimizes HTML, CSS, and JavaScript resources and, in addition, re-compresses pictures.

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.

An alternative to content encoding in the server-client layer is given by the off-line CrunchMe tool, which can create self extracting JavaScript programs using the DEFLATE compression algorithm.[citation needed]

See also

References


Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • Minification — may refer to: Magnification by a factor of less than one, producing a smaller image Minification (programming), a software coding technique Minimisation (psychology), a form of cognitive distortion This disambiguation page lists articles… …   Wikipedia

  • Minimisation (psychology) — For other uses, see Minimisation. Minification redirects here. For the programming technique, see Minification (programming). Minimisation is a type of deception[1] involving denial coupled with rationalisation in situations where complete denial …   Wikipedia

  • Minimisation — or minimization may refer to: The opposite of maximisation The opposite of magnification Minimisation (clinical trials) Minification (programming) Structural risk minimization In psychology: Minimisation is a defense mechanism In mathematics:… …   Wikipedia

  • Cascading Style Sheets — CSS redirects here. For other uses, see CSS (disambiguation). For the use of CSS on Wikipedia, see Help:Cascading style sheets. Cascading Style Sheets Filename extension .css Internet media type text/css Developed by World Wide Web Consortium …   Wikipedia

  • Anisotropic filtering — In 3D computer graphics, anisotropic filtering (abbreviated AF) is a method of enhancing the image quality of textures on surfaces that are at oblique viewing angles with respect to the camera where the projection of the texture (not the polygon… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”