|
|
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:
- Use the far-off Expires model in conjuction with Minify_Build (see Example 1).
- Benchmark your development server before rolling out to production.
- Place your HTTPd behind a reverse proxy, which can cache Minify URLs and serve them fast.
Will it get faster?
You bet.
- 2.0.2 beta has a new file cache system that makes minify almost 3x as fast! 2.0.1 had the overhead of always reading the cached file into memory, running crc32() on it, and storing the results in an array before echoing it.
- For Apache users we're designing a feature to enable minified and pre-encoded files to be served directly from the HTTPd. Requests will not execute PHP at all and be blazing fast. Even if you're not minifying files this will be faster gzip serving than with mod_deflate.
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.
Sign in to add a comment

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 ...
"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
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
in line 126 (before the exit)
Zoooooom, it's so fast!
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) { } else { }