What's new? | Help | Directory | Sign in
Google
minify
Combines, minifies, and caches JavaScript and CSS files on demand to speed up page loads.
  
  
  
  
    
Search
for
Updated Jun 24, 2008 by st...@mrclay.org
Labels: Featured
FAQ  
Frequently asked questions.

How fast is Minify?

With Minify you will ideally serve fewer requests, but Minify is certainly slower than your HTTPd serving flat files. If you have a high-traffic site with hundreds of simultaneous requests from new users, you should probably:

Will it get faster?

You bet.

Does Minify support gzip compression?

Yes. Based on the browser's Accept-Encoding header, Minify will serve content encoded with deflate or gzip.

Does Minify work with PHP opcode caches like APC and eAccelerator?

Yep!

Can Minify compress HTML markup?

Yes, and can even minify the embedded STYLE and SCRIPT elements. Example 2 demonstrates this.

How does Minify ensure that the client can't request files it shouldn't have access to?

Since VersionTwo, implementors are encouraged to explicitly define the URLs to respond to using controllers like "Groups".

The legacy Version1 controller behaves like the 1.0 releases and simply limits requests to files within the DOCUMENT_ROOT. It cannot know if you've configured your web server to protect an otherwise public directory (e.g. with .htaccess); a sneaky user can request .js/.css files from this directory if he/she guesses the path! In this situation the only way you can prevent serving the file is to make it unreadable by the PHP process.

Is Minify used in production by any large-scale websites?

Currently I'm not aware of any large-scale websites running Minify, but the project is still very young so not many people have heard of it yet. There are a few smaller SitesUsingMinify.

Can I use Minify with my commercial website or product?

Sure. Minify is distributed under the New BSD License, which means that you're free to use, modify, and redistribute Minify or derivative works thereof, even for commercial purposes, as long as you comply with a few simple requirements. See the LICENSE file for details.


Comment by f.vanderbiest, Jul 22, 2007

One more thing should appear in this FAQ : if some "minified" files aren't generated for some unknown reason, and if this happens when there are many files to minify, try increase your memory_limit to something like 64 or 128 Mb in your php.ini ...

Comment by tamlyn.rhodes, Jul 26, 2007

"A web browser would never be able to parse a mixture of both CSS and JavaScript?"

While I don't recommend the technique mentioned below, I thought it was worth pointing out that this statement is not quite true...

http://blogs.msdn.com/shivap/archive/2007/05/01/combine-css-with-js-and-make-it-into-a-single-download.aspx

Comment by msix81, Mar 14, 2008

In case someone wants to try gzip compression nonetheless without recompiling Apache:

Simply open minify.php and insert

ob_start('ob_gzhandler');

in line 118 (after the try) and

ob_end_flush();

in line 126 (before the exit)

Zoooooom, it's so fast!

Comment by mshawnb, Mar 16, 2008

Another way .. to add gzip compression w/o modifying Apache, add the following to the top of minify.php; the strpos() checks if the client accepts gzip; ob_end_flush() is not needed as this is done automatically at the end of script execution.

if (strpos($SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false) {

ob_start('ob_gzhandler');
} else {
ob_start();
}


Sign in to add a comment