Skip to content
Combines. minifies, and serves CSS or Javascript files
Branch: master
Clone or download
glensc Revert "simplify substr third param"
This reverts commit 5659799.

the change actually broken MinifyImportProcessorTest
Latest commit 258e495 Jan 5, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
builder Merge branch '2.x' Jun 27, 2016
docs cleanup 3.x branch leftover Jun 8, 2017
lib Revert "simplify substr third param" Jan 5, 2018
min_extras Improve Minify_Lines algorithm and add tests May 19, 2016
static Minify now allows static file serving Jun 29, 2016
tests tests: rename dataproviders not to be picked up as tests Jan 5, 2018
.gitattributes Port last of min_unit_tests, remove references to it, add composer sc… Nov 22, 2015
.gitignore Merge branch 'master' into static Jan 19, 2017
.php_cs phpcs: enable psr2 Oct 16, 2016
LICENSE.txt relative docs links Apr 3, 2017
config-test.php Collapse "min" into project root and get unit tests working. Sep 28, 2015
example.index.php Improves README and add install doc page Apr 2, 2016
index.php Large restructuring Mar 10, 2016
phpunit.xml Large restructuring Mar 10, 2016
quick-test.css Improves README and add install doc page Apr 2, 2016
quick-test.js Improves README and add install doc page Apr 2, 2016
quick-testinc.less Improves README and add install doc page Apr 2, 2016
server-info.php Merge branch '2.x' Mar 13, 2017

Welcome to Minify!

Minify is an HTTP server for JS and CSS assets. It compresses and combines files and serves it with appropriate headers, allowing conditional GET or long-Expires.

Before 7 requests
After 2 requests

The stats above are from a brief walkthrough which shows how easy it is to set up Minify on an existing site. It eliminated 5 HTTP requests and reduced JS/CSS bandwidth by 70%.

Relative URLs in CSS files are rewritten to compensate for being served from a different directory.

Static file serving

Version 3 allows serving files directly from the filesystem for much better performance. We encourage you to try this feature.


Post to the Google Group.


See the install guide.

Configuration & Usage

(Using 2.x? Here are the 2.x docs.)

See the user guide.

Minify also comes with a URI Builder application that can help you write URLs for use with Minify or configure groups of files.

See the cookbook for more advanced options for minification.

More docs are available.

Unit Testing

  1. Install dev deps via Composer: composer install
  2. composer test or phpunit


  • Minify is designed for efficiency, but, for very high traffic sites, it will probably serve files slower than your HTTPd due to the CGI overhead of PHP. See the FAQ and CookBook for more info.
  • If you combine a lot of CSS, watch out for IE's 4096 selectors-per-file limit, affects IE 6 through 9.
  • Minify should work fine with files encoded in UTF-8 or other 8-bit encodings like ISO 8859/Windows-1252. By default Minify appends ";charset=utf-8" to the Content-Type headers it sends.


Minify was inspired by jscsscomp by Maxim Martynyuk and by the article Supercharged JavaScript by Patrick Hunlock.

The JSMin library used for JavaScript minification was originally written by Douglas Crockford and was ported to PHP by Ryan Grove specifically for use in Minify.

You can’t perform that action at this time.