Skip to content
Combines. minifies, and serves CSS or Javascript files
PHP CSS JavaScript HTML Shell
Branch: master
Clone or download

Latest commit

glensc Merge pull request #672 from mrclay/fixer-psr2
Setup php-cs-fixer (@PSR2 rules only); Enable running in CI
Latest commit 8600312 Apr 3, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
builder Apply php-cs-fixer fixers Apr 3, 2020
docs cleanup 3.x branch leftover Jun 8, 2017
lib Apply php-cs-fixer fixers Apr 3, 2020
min_extras Apply php-cs-fixer fixers Apr 3, 2020
static Apply php-cs-fixer fixers Apr 3, 2020
tests Apply php-cs-fixer fixers Apr 3, 2020
.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 Setup php-cs-fixer Apr 3, 2020
.semver Minor changelog fixes Apr 3, 2020
.travis.yml Allow failures for php-cs-fixer Apr 3, 2020
CHANGELOG.md Minor changelog fixes Apr 3, 2020
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 Allow intervention/httpauth 3.x Mar 24, 2020
config-test.php Apply php-cs-fixer fixers Apr 3, 2020
config.php Apply php-cs-fixer fixers Apr 3, 2020
example.index.php Improves README and add install doc page Apr 2, 2016
groupsConfig.php Large restructuring Mar 10, 2016
index.php Apply php-cs-fixer fixers Apr 3, 2020
phpunit.xml Update phpunit.xml deprecated options, exclude vendor from code-coverage Mar 24, 2020
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 Apply php-cs-fixer fixers Apr 3, 2020
utils.php Apply php-cs-fixer fixers Apr 3, 2020

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.

You can’t perform that action at this time.