Combines. minifies, and serves CSS or Javascript files
PHP CSS JavaScript HTML Other
Latest commit 6a5b09a Jun 8, 2017 @glensc glensc Merge branch 'travis'
Permalink
Failed to load latest commit information.
builder Merge branch '2.x' Jun 27, 2016
docs cleanup 3.x branch leftover Jun 8, 2017
lib php-cs-fixer fix Apr 18, 2017
min_extras Improve Minify_Lines algorithm and add tests May 19, 2016
static Minify now allows static file serving Jun 29, 2016
tests closure: use 20161024 version Jun 8, 2017
.editorconfig do trim whitespace in editorconfig Jan 21, 2016
.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
.htaccess Collapse "min" into project root and get unit tests working. Sep 28, 2015
.php_cs phpcs: enable psr2 Oct 16, 2016
.travis.yml closure: use 20161024 version Jun 8, 2017
HISTORY.md 3.0.1 release notes Jun 8, 2017
LICENSE.txt moved unit_tests to min_unit_tests Sep 11, 2008
README.md relative docs links Apr 3, 2017
UPGRADING.txt Port last of min_unit_tests, remove references to it, add composer sc… Nov 22, 2015
bootstrap.php Composer compatibility - check if library is inside the vendor dir Mar 27, 2017
composer.json Update CSSmin to v4 Jun 8, 2017
config-test.php Collapse "min" into project root and get unit tests working. Sep 28, 2015
config.php Minify now allows static file serving Jun 29, 2016
example.index.php Improves README and add install doc page Apr 2, 2016
groupsConfig.php Large restructuring Mar 10, 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-test.less 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
utils.php Large restructuring Mar 10, 2016

README.md

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.

Support

Post to the Google Group.

Installation

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

Warnings

  • 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.

Acknowledgments

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.